Data defined caches for speculative and normal executions

ABSTRACT

A cache system, having: a first cache; a second cache; a configurable data bit; and a logic circuit coupled to a processor to control the caches based on the configurable bit. When the configurable bit is in a first state, the logic circuit is configured to: implement commands for accessing a memory system via the first cache, when an execution type is a first type; and implement commands for accessing the memory system via the second cache, when the execution type is a second type. When the configurable data bit is in a second state, the logic circuit is configured to: implement commands for accessing the memory system via the second cache, when the execution type is the first type; and implement commands for accessing the memory system via the first cache, when the execution type is the second type.

FIELD OF THE TECHNOLOGY

At least some embodiments disclosed herein relate generally to cachearchitecture and more specifically, but not limited to, cachearchitecture for main and speculative executions by computer processors.

BACKGROUND

A cache is a memory component that stores data closer to a processorthan the main memory so that data stored in the cache can be accessed bythe processor. Data can be stored in the cache as the result of anearlier computation or an earlier access to the data in the main memory.A cache hit occurs when the data requested by the processor using amemory address can be found in the cache, while a cache miss occurs whenit cannot.

In general, a cache is memory which holds data recently used by aprocessor. A block of memory placed in a cache is restricted to a cacheline accordingly to a placement policy. There are three generally knownplacement policies: direct mapped, fully associative, and setassociative. In a direct mapped cache structure, the cache is organizedinto multiple sets with a single cache line per set. Based on theaddress of a memory block, a block of memory can only occupy a singlecache line. With direct mapped caches, a cache can be designed as a(n*1) column matrix. In a fully associative cache structure, the cacheis organized into a single cache set with multiple cache lines. A blockof memory can occupy any of the cache lines in the single cache set. Thecache with fully associative structure can be designed as a (1*m) rowmatrix.

A set associative cache is an intermediately designed cache with astructure that is a middle ground between a direct mapped cache and afully associative cache. A set associative cache can be designed as a(n*m) matrix, where neither the n nor the m is 1. The cache is dividedinto n cache sets and each set contains m cache lines. A memory blockcan be mapped to a cache set and then placed into any cache line of theset. Set associative caches can include the range of caches from directmapped to fully associative when considering a continuum of levels ofset associativity. For example, a direct mapped cache can also bedescribed as a one-way set associative cache and a fully associativecache with m blocks can be described as a m-way set associative cache.Directed mapped caches, two-way set associative caches, and four-way setassociative caches are commonplace in cache systems.

Speculative execution is a computing technique where a processorexecutes one or more instructions based on the speculation that suchinstructions need to be executed under some conditions, before thedetermination result is available as to whether such instructions shouldbe executed or not.

A memory address in a computing system identifies a memory location inthe computing system. Memory addresses are fixed-length sequences ofdigits conventionally displayed and manipulated as unsigned integers.The length of the sequences of digits or bits can be considered thewidth of the memory addresses. Memory addresses can be used in certainstructures of central processing units (CPUs), such as instructionpointers (or program counters) and memory address registers. The size orwidth of such structures of a CPU typically determines the length ofmemory addresses used in such a CPU.

BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments are illustrated by way of example and not limitation inthe figures of the accompanying drawings in which like referencesindicate similar elements.

FIGS. 1A to 1E shows various ways to partition a memory address intomultiple parts that can be used with an execution type to control theoperations of a cache, in accordance with some embodiments of thepresent disclosure.

FIGS. 2, 3A, and 3B show example aspects of example computing devices,each computing device including a cache system having interchangeablecaches for first type and second type executions, in accordance withsome embodiments of the present disclosure.

FIGS. 4, 5A, and 5B show example aspects of example computing devices,each computing device including a cache system having interchangeablecaches for main type and speculative type executions specifically, inaccordance with some embodiments of the present disclosure.

FIGS. 6, 7A, 7B, 8A, 8B, 9A, and 9B show example aspects of examplecomputing devices, each computing device including a cache system havinginterchangeable cache sets for first type and second type executions(e.g., main type and speculative type executions), in accordance withsome embodiments of the present disclosure.

FIG. 10 shows example aspects of an example computing device including acache system having interchangeable cache sets for main type andspeculative type executions specifically, in accordance with someembodiments of the present disclosure.

FIGS. 11A and 11B illustrate background synching circuitry forsynchronizing content between a main cache and a shadow cache to savethe content cached in the main cache in preparation of acceptance of thecontent in the shadow cache, in accordance with some embodiments of thepresent disclosure.

FIG. 12 show example operations of the example syncing circuitry ofFIGS. 11A and 11B, in accordance with some embodiments of the presentdisclosure.

FIGS. 13, 14A, 14B, 14C, 15A, 15B, 15C, and 15D show example aspects ofan example computing device having a cache system having interchangeablecache sets including a spare cache set to accelerate speculativeexecution, in accordance with some embodiments of the presentdisclosure.

FIGS. 16 and 17 show example aspects of example computing devices havingcache systems having interchangeable cache sets utilizing extended tagsfor different types of executions by a processor (such as speculativeand non-speculative executions), in accordance with some embodiments ofthe present disclosure.

FIG. 18 shows example aspects of example computing device having a cachesystem having interchangeable cache sets utilizing a circuit to mapphysical cache set outputs to logical cache set outputs, in accordancewith some embodiments of the present disclosure.

FIGS. 19, 20, and 21 show example aspects of example computing deviceshaving cache systems having interchangeable cache sets utilizing thecircuit shown in FIG. 18 to map physical cache set outputs to logicalcache set outputs, in accordance with some embodiments of the presentdisclosure.

FIGS. 22 and 23 show methods for using interchangeable cache sets forspeculative and non-speculative executions by a processor, in accordancewith some embodiments of the present disclosure.

DETAILED DESCRIPTION

The present disclosure includes techniques to use multiple caches orcache sets of a cache interchangeably with different types of executionsby a connected processor. The types of executions can includespeculative and non-speculative execution threads. Non-speculativeexecution can be referred to as main execution or normal execution.

For enhanced security, when a processor performs conditional speculativeexecution of instructions, the processor can be configured to use ashadow cache during the speculative execution of the instructions, wherethe shadow cache is separate from the main cache that is used during themain execution or normal execution of instructions. Some techniques ofusing a shadow cache to improve security can be found in U.S. patentapplication Ser. No. 16/028,930, filed Jul. 6, 2018 and entitled “ShadowCache for Securing Conditional Speculative Instruction Execution,” theentire disclosure of which is here by incorporated herein by reference.The present disclosure includes techniques to allow a cache to beconfigured dynamically as a shadow cache or a main cache; a unified setof cache resources can be dynamically allocated for the shadow cache orfor the main cache; and the allocation can be changed during theexecution of instructions.

In some embodiments, a system can include a memory system (e.g.,including main memory), a processor, and a cache system coupled betweenthe processor and memory system. The cache system can have a set ofcaches. And, a cache of the set of caches can be designed in multipleways. For instance, a cache in the set of caches can include cache setsthrough cache set associativity (which can include physical or logicalcache set associativity).

In some embodiments, caches of the system can be changeable betweenbeing configured for use in a first type of execution of instructions bythe processor and being configured for use in a second type of executionof instructions by the processor. The first type can be anon-speculative execution of instructions by the processor. The secondtype can be a speculative execution of instructions by the processor.

In some embodiments, cache sets of a cache can be changeable betweenbeing configured for use in a first type of execution of instructions bythe processor and being configured for use in a second type of executionof instructions by the processor. The first type can be anon-speculative execution of instructions by the processor. And, thesecond type can be a speculative execution of instructions by theprocessor.

In some embodiments, speculative execution is where the processorexecutes one or more instructions based on a speculation that suchinstructions need to be executed under some conditions, before thedetermination result is available as to whether such instructions shouldbe executed or not. Non-speculative execution (or main execution, ornormal execution) is where instructions are executed in an orderaccording to the program sequence of the instructions.

In some embodiments, the set of caches of the system can include atleast a first cache and a second cache. In such examples, the system caninclude a command bus, configured to receive a read command or a writecommand from the processor. The system can also include an address bus,configured to receive a memory address from the processor for accessingmemory for a read command or a write command. And, a data bus can beincluded that is configured to: communicate data to the processor forthe processor to read; and receive data from the processor to be writtenin memory. The memory access requests from the processor can be definedby the command bus, the address bus, and the data bus.

In some embodiments, a common command and address bus can replace thecommand and address buses described herein. Also, in such embodiments, acommon connection to the common command and address bus can replace therespective connections to command and address buses described herein.

The system can also include an execution-type signal line that isconfigured to receive an execution type from the processor. Theexecution type can be either an indication of a normal ornon-speculative execution or an indication of a speculative execution.

The system can also include a configurable data bit that is configuredto be set to a first state (e.g., “0”) or a second state (e.g., “1) tochange the uses of the first cache and the second cache with respect tonon-speculative execution and speculative execution.

The system can also include a logic circuit that is configured to selectthe first cache for a memory access request from the processor, when theconfigurable data bit is set to the first state and the execution-typesignal line receives an indication of non-speculative execution. Thelogic circuit can also be configured to select the second cache for amemory access request from the processor, when the configurable data bitis set to the first state and the execution-type signal line receives anindication of speculative execution. The logic circuit can also beconfigured to select the second cache for a memory access request fromthe processor, when the configurable data bit is set to the second stateand the execution-type signal line receives an indication of anon-speculative execution. The logic circuit can also be configured toselect the first cache for a memory access request from the processor,when the configurable data bit is set to the second state and theexecution-type signal line receives an indication of a speculativeexecution.

The system can also include a speculation-status signal line that isconfigured to receive speculation status from the processor. Thespeculation status can be either a confirmation or a rejection of acondition with nested instructions that are executed initially by aspeculative execution and subsequently by a non-speculative executionwhen the speculation status is the confirmation of the condition.

The logic circuit can also be configured to select the second cache asidentified by the first state of the configurable data bit and restrictthe first cache from use or change as identified by the first state ofthe configurable data bit, when the signal received by theexecution-type signal line changes from an indication of anon-speculative execution to an indication of a speculative execution.

Also, the logic circuit can be configured to change the configurabledata bit from the first state to the second state and select the secondcache for a memory access request when the execution-type signal linereceives an indication of a non-speculative execution. This can occurwhen the signal received by the execution-type signal line changes fromthe indication of the speculative execution to the indication of thenon-speculative execution and when the speculation status received bythe speculation-status signal line is the confirmation of the condition.

The logic circuit can also be configured to maintain the first state ofthe configurable data bit and select the first cache for a memory accessrequest when the execution-type signal line receives an indication of anon-speculative execution. This can occur when the signal received bythe execution-type signal line changes from the indication of thespeculative execution to the indication of the non-speculative executionand when the speculation status received by the speculation-statussignal line is the rejection of the condition. Also, the logic circuitcan be configured to invalidate and discard the contents of the secondcache, when the signal received by the execution-type signal linechanges from the indication of the speculative execution to theindication of the non-speculative execution and when the speculationstatus received by the speculation-status signal line is the rejectionof the condition.

The system can also include a second command bus, configured tocommunicate a read command or a write command to a main memory connectedto the cache system. The read command or the write command can bereceived from the processor by the cache system. The system can alsoinclude a second address bus, configured to communicate a memory addressto the main memory. The memory address can be received from theprocessor by the cache system. The system can also include a second databus, configured to communicate data to the main memory to be written inmemory, and receive data from the main memory to be communicated to theprocessor to be read by the processor. Memory access requests to themain memory from the cache system can be defined by the second commandbus, the second address bus, and the second data bus.

As mentioned, a cache of the set of caches can be designed in multipleways, and one of those ways includes a cache of a set divided into cachesets through cache set associativity (which can include physical orlogical cache set associativity). A benefit of cache design through setassociativity is that a single cache with set associativity can havemultiple cache sets within the single cache, and thus, different partsof the single cache can be allocated for use by the processor withoutallocating the entire cache. Therefore, the single cache can be usedmore efficiently. This is especially the case when the processorexecutes multiple types of threads or has multiple execution types. Forinstance, the cache sets within a single cache can be usedinterchangeably with different execution types instead of the use ofinterchangeable caches. Common examples of cache division include havingtwo, four, or eight cache sets within a cache.

Also, set associativity cache design is advantageous over other commoncache designs when the processor executes main and speculative threads.Since a speculative execution may use less additional cache capacitythan the normal or non-speculative execution, the selection mechanismcan be implemented at a cache set level and thus reserve less space thanan entire cache (i.e., a fraction of a cache) for speculative execution.Cache with set associativity can have multiple cache sets within a set(e.g., division of two, four, or eight cache sets within a cache). Forinstance, as shown in FIG. 7A, there are a least four cache sets in acache of a cache system (e.g., see cache sets 702, 704, and 706). Thenormal or non-speculative execution, which usually demands most of cachecapacity can have a larger numbers of cache sets delegated to it. And,the speculative execution with modifications over the non-speculativeexecution can use one cache set or a smaller number of cache sets, sincethe speculative execution typically involving less instructions than thenon-speculative execution.

As shown in FIG. 6 or 10, a cache system can include multiple caches(such as caches 602 a, 602 b, and 602 c depicted in FIG. 6) for aprocessor and a cache of a cache system can include cache sets (such ascache sets 610 a, 610 b, and 610 c depicted in FIG. 6) to further dividethe organization of the cache system. Such an example includes a cachesystem with set associativity.

On the cache set level of a cache, a first cache set (e.g., see cacheset 702 depicted in FIG. 7A, FIGS. 8A, and 9A) can hold content for usewith a first type of execution by the processor or a second type. Forinstance, the first cache set can hold content for use with anon-speculative type or a speculative type of execution by theprocessor. Also, a second cache set (e.g., see cache set 704 or 706depicted in FIG. 7A, FIGS. 8A, and 9A) can hold content for use with thefirst type of execution by the processor or the second type.

For example, in a first time instance, a first cache set is used fornormal or non-speculative execution and a second cache set is used forspeculative execution. In a second time instance, the second cache setis used for normal or non-speculative execution and the first cache setis used for speculative execution. A way of delegating/switching thecache sets for non-speculative and speculative executions can use setassociativity via a cache set index within or external to a memoryaddress tag or via a cache set indicator within a memory address tagthat is different from a cache set index (e.g., see FIGS. 7A, 7B, 8A,8B, 9A, and 9B).

As shown in at least FIGS. 1B, 1C, 1D, 1E, 7A, 7B, 8A, 8B, 9A, and 9B, acache set index or a cache set indicator can be included in cache blockaddressing to implement cache set addressing and associativity. Cacheblock addressing can be stored in memory (e.g., SRAM, DRAM, etc.depending on design of computing device-design of processor registers,cache system, other intermediate memory, main memory, etc.).

As shown in FIGS. 6, 7A, 7B, 8A, 8B, 9A, 9B, and 10, each cache set of acache (e.g., level 1, level 2 or level 3 cache) has a respectiveregister (e.g., register 610 a, 610 b, or 610 c shown in FIGS. 6 and 10or register 712, 714, or 716 shown in FIGS. 7A, 7B, 8A, 8B, 9A, and 9B)and one of set indexes (e.g., see set indexes 722, 724, 726, and 728shown in FIGS. 7A, 7B, 8A, 8B, 9A, and 9B) that can be swapped betweenthe respective registers to implement swapping of cache sets fornon-speculative and speculative executions of the processor (or, ingeneral, for first type and second type executions of the processor).For example, with respect to FIGS. 7A and 7B, at a first time period, afirst type of execution can use cache sets 702 and 704 and a second typeof execution can use cache set 706. Then, at a second time period, thefirst type of execution can use cache sets 704 and 706 and the secondtype of execution can use cache set 702. Note this is just one exampleusage of cache sets, and it is to be understood that any of the cachesets without a predetermined restriction can be used by the first orsecond types of execution depending on time periods or set indexes orindicators stored in the registers.

In some embodiments, a number of cache sets can be initially allocatedfor use in the first type of execution (e.g., non-speculativeexecution). During the second type of execution (e.g., speculativeexecution), one of the cache sets initially used for the first type ofexecution or not (such as a reserved cache set) can be used in thesecond type of execution. Essentially, a cache set allocated for thesecond type of execution can be initially a free cache set waiting to beused, or selected from the number of cache sets used for the first typeof execution (e.g., a cache set that is less likely to be further usedin further first type executions).

In general, in some embodiments, the cache system includes a pluralityof cache sets. The plurality of cache sets can include a first cacheset, a second cache set, and a plurality of registers associated withthe plurality of cache sets respectively. The plurality of registers caninclude a first register associated with the first cache set and asecond register associated with the second cache set. The cache systemcan also include a connection to a command bus coupled between the cachesystem and a processor, a connection to an address bus coupled betweenthe cache system and the processor, and a connection to a data buscoupled between the cache system and the processor. The cache system canalso include a logic circuit coupled to the processor to control theplurality of cache sets according to the plurality of registers.

In such embodiments, the cache system can be configured to be coupledbetween the processor and a memory system. And, when the connection tothe address bus receives a memory address from the processor, the logiccircuit can be configured to generate a set index from at least thememory address (e.g., see set index generation 730, 732, 830, 832, 930,and 932 shown in FIGS. 7A, 7B, 8A, 8B, 9A, and 9B respectively). Also,when the connection to the address bus receives a memory address fromthe processor, the logic circuit can be configured to determine whetherthe generated set index matches with content stored in the firstregister or with content stored in the second register. Also, the logiccircuit can be configured to implement a command received in theconnection to the command bus via the first cache set in response to thegenerated set index matching with the content stored in the firstregister and via the second cache set in response to the generated setindex matching with the content stored in the second register. Also, inresponse to a determination that a data set of the memory systemassociated with the memory address is not currently cached in the cachesystem, the logic circuit can be configured to allocate the first cacheset for caching the data set and store the generated set index in thefirst register. The generated set index can include a predeterminedsegment of bits in the memory address.

The cache system can also include a connection to an execution-typesignal line from the processor identifying an execution type (e.g., seeconnection 604 d depicted in FIGS. 6 and 10). In such embodiments, thegenerated set index can be generated further based on a type identifiedby the execution-type signal line. Also, the generated set index caninclude a predetermined segment of bits in the memory address and a bitrepresenting the type identified by the execution-type signal line(e.g., the generated set index can include or be derived from thepredetermined segment of bits in the memory address 102 e and one ormore bits representing the type identified by the execution-type signalline, in execution type 110 e, shown in FIG. 1E).

Also, when the first and second registers are in a first state, thelogic circuit can be configured to: implement commands received from thecommand bus for accessing the memory system via the first cache set,when the execution type is a first type; and implement commands receivedfrom the command bus for accessing the memory system via the secondcache set, when the execution type is a second type. Also, when thefirst and second registers are in a second state, the logic circuit canbe configured to: implement commands received from the command bus foraccessing the memory system via another cache set of the plurality ofcache sets besides the first cache set, when the execution type is thefirst type; and implement commands received from the command bus foraccessing the memory system via another other cache set of the pluralityof cache sets besides the second cache set, when the execution type isthe second type. In such an example, each one of the plurality ofregisters can be configured to store a set index, and when the executiontype changes from the second type to the first type, the logic circuitcan be configured to change the content stored in the first register andthe content stored in the second register.

In some embodiments, the first type is configured to indicatenon-speculative execution of instructions by the processor; and thesecond type is configured to indicate speculative execution ofinstructions by the processor. In such embodiments, the cache system canfurther include a connection to a speculation-status signal line fromthe processor identifying a status of a speculative execution ofinstructions by the processor (e.g., see connection 1002 shown in FIG.10). The connection to the speculation-status signal line can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution can indicate that a result of aspeculative execution is to be accepted or rejected. Each one of theplurality of registers can be configured to store a set index, and whenthe execution type changes from the second type to the first type, thelogic circuit can be configured to change the content stored in thefirst register and the content stored in the second register, if thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted (e.g., see the changes of the content storedin the registers shown between FIG. 7A and FIG. 7B, shown between FIG.8A and FIG. 8B, and shown between FIG. 9A and FIG. 9B). And, when theexecution type changes from the second type to the first type, the logiccircuit can be configured to maintain the content stored in the firstregister and the content stored in the second register without changes,if the status of speculative execution indicates that a result ofspeculative execution is to be rejected.

Additionally, the cache systems described herein (e.g., cache systems200, 400, 600, and 1000) can each include or be connected to backgroundsyncing circuitry (e.g., see background syncing circuitry 1102 shown inFIGS. 11A and 11B). The background syncing circuitry can be configuredto synchronize caches or cache sets before reconfiguring a shadow cacheas a main cache and/or reconfiguring a main cache as shadow cache.

For example, the content of a cache or cache set that is initiallydelegated for a speculative execution (e.g., an extra cache or a sparecache set delegated for a speculative execution) can be synced with acorresponding cache or cache set used by a normal or non-speculativeexecution (to have the cache content of the normal execution), such thatif the speculation is confirmed, the cache or cache set that isinitially delegated for the speculative execution can immediately jointhe cache sets of a main or non-speculative execution. Also, theoriginal cache set corresponding to the cache or cache set that isinitially delegated for the speculative execution can be removed fromthe group of cache sets used for the main or non-speculative execution.In such embodiments, a circuit, such as a circuit including thebackground synching circuitry, can be configured to synchronize cachesor cache sets in the background to reduce the impact of cache setsyncing on cache usage by the processor. Also, the synchronization ofthe cache or cache sets can continue either until the speculation isabandoned, or until the speculation is confirmed and the syncing iscomplete. The synchronization may optionally include syncing (e.g.,writing back) to the memory.

In some embodiments, a cache system can include a first cache and asecond cache as well as a connection to a command bus coupled betweenthe cache system and a processor, a connection to an address bus coupledbetween the cache system and the processor, a connection to a data buscoupled between the cache system and the processor, and a connection toan execution-type signal line from the processor identifying anexecution type (e.g., see cache systems 200 and 400). Such a cachesystem can also include a logic circuit coupled to control the firstcache and the second cache according to the execution type, and thecache system can be configured to be coupled between the processor and amemory system. Also, when the execution type is a first type indicatingnon-speculative execution of instructions by the processor and the firstcache is configured to service commands from the command bus foraccessing the memory system, the logic circuit can be configured to copya portion of content cached in the first cache to the second cache(e.g., see operation 1202). Further, the logic circuit can be configuredto copy the portion of content cached in the first cache to the secondcache independent of a current command received in the command bus.

Additionally, when the execution type is the first type indicatingnon-speculative execution of instructions by the processor and the firstcache is configured to service commands from the command bus foraccessing the memory system, the logic circuit can be configured toservice subsequent commands from the command bus using the second cachein response to the execution type being changed from the first type to asecond type indicating speculative execution of instructions by theprocessor (e.g., see operation 1208). In such an example, the logiccircuit can be configured to complete synchronization of the portion ofthe content from the first cache to the second cache before servicingthe subsequent commands after the execution type is changed from thefirst type to the second type (e.g., see FIG. 12). The logic circuit canalso be configured to continue synchronization of the portion of thecontent from the first cache to the second cache while servicing thesubsequent commands (e.g., see operation 1210).

In such embodiments, the cache system can also include a configurabledata bit, wherein the logic circuit is further coupled to control thefirst cache and the second cache according to the configurable data bit.Also, in such embodiments, the cache system can further include aplurality of cache sets. For instance, the first cache and the secondcache together can include the plurality of cache sets, and a pluralityof cache sets can include a first cache set and a second cache set. Thecache system can also include a plurality of registers associated withthe plurality of cache sets respectively. The plurality of registers caninclude a first register associated with the first cache set and asecond register associated with the second cache set. And, in suchembodiments, the logic circuit can be further coupled to control theplurality of cache sets according to the plurality of registers.

In some embodiments, a cache system can include a plurality of cachesets that includes a first cache set and a second cache set. The cachesystem can also include a plurality of registers associated with theplurality of cache sets respectively, which includes a first registerassociated with the first cache set and a second register associatedwith the second cache set. In such embodiments, the cache system caninclude a plurality of caches that include a first cache and a secondcache, and the first cache and the second cache together can include atleast part of the plurality of cache sets. Such a cache system can alsoinclude a connection to a command bus coupled between the cache systemand a processor, a connection to an address bus coupled between thecache system and the processor, a connection to a data bus coupledbetween the cache system and the processor, and a connection to anexecution-type signal line from the processor identifying an executiontype, as well as a logic circuit coupled to control the plurality ofcache sets according to the execution type.

In such embodiments, the cache system can be configured to be coupledbetween the processor and a memory system. And, when the execution typeis a first type indicating non-speculative execution of instructions bythe processor and the first cache set is configured to service commandsfrom the command bus for accessing the memory system, the logic circuitis configured to copy a portion of content cached in the first cache setto the second cache set. The logic circuit can also be configured tocopy the portion of content cached in the first cache set to the secondcache set independent of a current command received in the command bus.

Also, when the execution type is the first type indicatingnon-speculative execution of instructions by the processor and the firstcache set is configured to service commands from the command bus foraccessing the memory system, the logic circuit can be configured toservice subsequent commands from the command bus using the second cacheset in response to the execution type being changed from the first typeto a second type indicating speculative execution of instructions by theprocessor. The logic circuit can also be configured to completesynchronization of the portion of the content from the first cache setto the second cache set before servicing the subsequent commands afterthe execution type is changed from the first type to the second type.The logic circuit can also be configured to continue synchronization ofthe portion of the content from the first cache set to the second cacheset while servicing the subsequent commands. And, the logic circuit canbe further coupled to control the plurality of cache sets according tothe plurality of registers.

In addition to using a shadow cache for securing speculative executions,and synchronizing content between a main cache and the shadow cache tosave the content cached in the main cache in preparation of acceptanceof the content in the shadow cache, a spare cache set can be used toaccelerate the speculative executions. Also, a spare cache set can beused to accelerate the speculative executions without use of a shadowcache. Use of a spare cache set is useful with shadow cacheimplementations because data held in cache sets used as a shadow cachecan be validated and therefore used for normal execution and some cachesets used as the main cache may not be ready to be used as the shadowcache. Thus, one or more cache sets can be used as spare cache sets toavoid delays from waiting for cache set availability. To put it anotherway, once a speculation is confirmed, the content of the cache sets usedas a shadow cache is confirmed to be valid and up-to-date; and thus, theformer cache sets used as the shadow cache for speculative execution areused for normal execution. However, some of the cache sets initiallyused as the normal cache may not be ready to be used for a subsequentspeculative execution. Therefore, one or more cache sets can be used asspares to avoid delays from waiting for cache set availability andaccelerate the speculative executions.

In some embodiments, if the syncing from a cache set in the normal cacheto a corresponding cache set in the shadow cache has not yet beencompleted, the cache set in the normal cache cannot be freed immediatelyfor use in the next speculative execution. In such a situation, if thereis no spare cache set, the next speculative execution has to wait untilthe syncing is complete so that the corresponding cache set in thenormal cache can be freed. This is just one example, of when a sparecache set is beneficial and can be added to an embodiment. And, thereare many other situations when cache sets in the normal cache cannot befreed immediately so a spare cache set can be useful.

Also, in some embodiments, the speculative execution may reference amemory region that has no overlapping with the memory region cached inthe cache sets used in the normal cache. As a result of accepting theresult of the speculative execution, the cache sets in the shadow cacheand the normal cache may all be in the normal cache. This can causedelays as well, because it takes time for the cache system to free acache set to support the next speculative execution. To free one, thecache system can identify a cache set, such as a least used cache set,and synchronize the cache set with the memory system. If the cache hasdata that is more up to date than the memory system, the data can bewritten into the memory system.

Additionally, a system using a spare cache set can also use backgroundsynchronizing circuitry such as the background synchronizing circuitry1102 depicted in FIGS. 11A and 11B. The background synchronizingcircuitry 1102 can be a part of the logic circuit 606 or 1006, in someembodiments. When an initial speculation is confirmed, the cache setused in the initial speculation can be switched to join the set of cachesets used for a main execution. Instead of using a cache set from theprior main execution that was being used for a case of the speculationfailing, a spare cache set can be made available immediately for a nextspeculative execution. Also, the spare cache set can be updated for thenext speculative execution via the background synchronizing circuitry.And, because of background synchronizing, a spare cache set can be readyfor use when the cache set currently used for the speculation executionis ready to be accepted for normal execution. This way there is no delayin waiting for use of the next cache set for the next speculativeexecution. To prepare for the next speculative execution, the sparecache set can be synchronized to a normal cache set that is likely to beused in the next speculative execution or a least used cache set in thesystem.

In addition to using a shadow cache, synchronizing content between amain cache and the shadow cache, and using a spare cache set, extendedtags can be used to improve use of interchangeable caches and cachessets for different types of executions by a processor (such asspeculative and non-speculative executions). There are many differentways to address cache sets and cache blocks within a cache system usingextended tagging. Two example ways are shown in FIGS. 16 and 17.

In general, cache sets and cache blocks can be selected via a memoryaddress. In some examples, selection is via set associativity. Bothexamples in FIGS. 16 and 17 use set associativity. In FIG. 16, setassociativity is implicitly defined (e.g., defined through an algorithmthat can be used to determine which tag should be in which cache set fora given execution type). In FIG. 17, set associativity is implementedvia the bits of cache set index in the memory address. Also, parts ofthe functionality illustrated in FIGS. 16 and 17 can be implementedwithout use of set associativity (although this is not depicted in FIGS.16 and 17).

In some embodiments, including embodiments shown in FIGS. 16 and 17, ablock index can be used as an address within individual cache sets toidentify particular cache blocks in a cache set. And, the extended tagscan be used as addresses for the cache sets. A block index of a memoryaddress can be used for each cache set to get a cache block and a tagassociated with the cache block. Also, as shown in FIGS. 16 and 17, tagcompare circuits can compare the extended tags generated from the cachesets with the extended cache tag generated from a memory address and acurrent execution type. The output of the comparison can be a cache hitor miss. The construction of the extended tags guarantee that there isat most one hit among the cache sets. If there is a hit, a cache blockfrom the selected cache set provides the output. Otherwise, the dataassociated with the memory address is not cached in or outputted fromany of the cache sets. In short, the extended tags depicted in FIGS. 16and 17 are used to select a cache set, and the block indexes are used toselect a cache block and its tag within a cache set.

Also, as shown in FIG. 17, the combination of a tag and a cache setindex in the system can provide somewhat similar functionality as merelyusing a tag—as shown in FIG. 16. However, in FIG. 17, by separating thetag and the cache set index, a cache set does not have to storeredundant copies of the cache set index since a cache set can beassociated with a cache set register to hold cache set indexes. Whereas,in FIG. 16, a cache set does need to store redundant copies of a cacheset indicator in each of its blocks. However, since tags have the samecache set indicator in embodiments depicted in FIG. 16, the indicatorcould be stored once in a register for the cache set (e.g., see cacheset registers shown in FIG. 17). A benefit of using cache set registersis that the lengths of the tags can be shorter in comparison with animplementation of the tags without cache set registers.

Both of the embodiments shown in FIGS. 16 and 17 have cache setregisters configured to hold an execution type so that the correspondingcache sets can be used in implementing different execution types (e.g.,speculative and non-speculative execution types). But, the embodimentshown in FIG. 17 has registers that are further configured to hold anexecution type and a cache set index. When the execution type iscombined with the cache set index to form an extended cache set index,the extended cache set index can be used to select one of the cache setswithout depending on the addressing through tags of cache blocks. Also,when a tag from a selected cache set is compared to the tag in theaddress to determine hit or miss, the two-stage selection can be similarto a conventional two-stage selection using a cache set index or can beused to be combined with the extended tag to support interchanging ofcache sets for different execution types.

In addition to using extended tags as well as other techniques disclosedherein to improve use of interchangeable caches and caches sets fordifferent types of executions by a processor, a circuit included in orconnected to the cache system can be used to map physical outputs fromcache sets of a cache hardware system to a logical main cache and alogical shadow cache for normal and speculative executions by theprocessor respectively. The mapping can be according to at least onecontrol register (e.g., a physical-to-logical-set-mapping (PLSM)register).

Also, disclosed herein are computing devices having cache systems havinginterchangeable cache sets utilizing a mapping circuit (such as mappingcircuit 1830 shown in FIG. 18) to map physical cache set outputs tological cache set outputs. A processor coupled to the cache system canexecute two types of threads such as speculative and non-speculativeexecution threads. The speculative thread is executed speculatively witha condition that has not yet been evaluated. The data of the speculativethread can be in a logical shadow cache. The data of the non-speculativethread can be in the logical main or normal cache. Subsequently, whenthe result of evaluating the condition becomes available, the system cankeep the results of executing the speculative thread when the conditionrequires the execution of the thread, or remove it. With the mappingcircuit, the hardware circuit for the shadow cache can be repurposed asthe hardware circuit for the main cache by changing the content of thecontrol register. Thus, for example, there is no need to synchronize themain cache with the shadow cache if the execution of the speculativethread is required.

In a conventional cache, each cache set is statically associated with aparticular value of “Index S”/“Block Index L”. In the cache systemsdisclosed herein, any cache set can be used for any purpose for anyindex value S/L and for a main cache or a shadow cache. Cache sets canbe used and defined by data in cache set registers associated with thecache sets. A selection logic can then be used to select the appropriateresult based on the index value of S/L and how the cache sets are used.

For example, four cache sets, a cache set 0 to set 3, can be initiallyused for a main cache for S/L=00, 01, 10 and 11 respectively. A fourthcache set can be used as the speculative cache for S/L=00, assuming thatspeculative execution does not change the cache sets defined by 01, 10and 11. If the result of the speculative execution is required, themapping data can be changed to indicate that the main cache for S/L=00,01, 10 and 11 are respectively for the fourth cache set, cache set 1,cache set 2, and cache set 3. Cache set 0 can then be freed orinvalidated for subsequent use in a speculative execution. If the nextspeculative execution needs to change the cache set S/L to 01, cache set0 can be used as the shadow cache (e.g., copied from cache set 1 andused to look up content for addresses with S/L equaling ‘01’.

Also, the cache system and processor does not merely switch back andforth between a predetermined main thread and a predeterminedspeculative thread. Consider the speculative execution of the followingpseudo-program.

Instructions A;

If condition=true,

-   -   then Instructions B;

End conditional loop;

Instructions C; and

Instructions D.

For the pseudo-program, the processor can run two threads.

Thread A:

Instructions A;

Instructions C; and

Instructions D.

Thread B:

Instructions A;

Instructions B;

Instructions C; and

Instructions D.

The execution of Instructions B is speculative because it depends on thetest result of “condition=true” instead of “condition=false”. Theexecution of Instructions B is required only when condition=true. By thetime the result of the test “condition=true” becomes available, theexecution of Thread A reached Instructions D and the execution of ThreadA may reach Instructions C. If the test result requires the execution ofInstructions B, cache content for thread B is correct and cache contentfor thread A is incorrect. Then, all changes made in the cache accordingto Thread B should be retained and the processor can continue theexecution of Instructions C using the cache that has the results ofexecuting Instructions B; and Thread A is terminated. Since the changesmade according to Thread B is in the shadow cache, the content of theshadow cache should be accepted as the main cache. If the test resultrequires no execution of Instructions B, the results of the Thread B isdiscarded (e.g., the content of the shadow cache is discarded orinvalidated).

The cache sets used for the shadow and the normal cache can be swappedor changed according to a mapping circuit and a control register (e.g.,a physical-to-logical-set-mapping (PLSM) register). In some embodiments,a cache system can include a plurality of cache sets, having a firstcache set configured to provide a first physical output upon a cache hitand a second cache set configured to provide a second physical outputupon a cache hit. The cache system can also include a connection to acommand bus coupled between the cache system and a processor and aconnection to an address bus coupled between the cache system and theprocessor. The cache system can also include the control register, andthe mapping circuit coupled to the control register to map respectivephysical outputs of the plurality of cache sets to a first logical cacheand a second logical cache according to a state of the control register.The cache system can be configured to be coupled between the processorand a memory system.

When the connection to the address bus receives a memory address fromthe processor and when the control register is in a first state, themapping circuit can be configured to: map the first physical output tothe first logical cache for a first type of execution by the processorto implement commands received from the command bus for accessing thememory system via the first cache set during the first type ofexecution; and map the second physical output to the second logicalcache for a second type of execution by the processor to implementcommands received from the command bus for accessing the memory systemvia the second cache set during the second type of execution. And, whenthe connection to the address bus receives a memory address from theprocessor and when the control register is in a second state, themapping circuit is configured to: map the first physical output to thesecond logical cache to implement commands received from the command busfor accessing the memory system via the first cache set during thesecond type of execution; and map the second physical output to thefirst logical cache to implement commands received from the command busfor accessing the memory system via the second cache set for the firsttype of execution.

In some embodiments, the first logical cache is a normal cache fornon-speculative execution by the processor, and the second logical cacheis a shadow cache for speculative execution by the processor.

Also, in some embodiments, the cache system can further include aplurality of registers associated with the plurality of cache setsrespectively, including a first register associated with the first cacheset and a second register associated with the second cache set. Thecache system can also include a logic circuit coupled to the processorto control the plurality of cache sets according to the plurality ofregisters. When the connection to the address bus receives a memoryaddress from the processor, the logic circuit can be configured togenerate a set index from at least the memory address, as well asdetermine whether the generated set index matches with a content storedin the first register or with a content stored in the second register.And, the logic circuit can be configured to implement a command receivedin the connection to the command bus via the first cache set in responseto the generated set index matching with the content stored in the firstregister and via the second cache set in response to the generated setindex matching with the content stored in the second register.

In some embodiments, the mapping circuit can be a part of or connectedto the logic circuit and the state of the control register can control astate of a cache set of the plurality of cache sets. In someembodiments, the state of the control register can control the state ofa cache set of the plurality of cache sets by changing a valid bit foreach block of the cache set.

Also, in some examples, the cache system can further include aconnection to a speculation-status signal line from the processoridentifying a status of a speculative execution of instructions by theprocessor. The connection to the speculation-status signal line can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution can indicate that a result of aspeculative execution is to be accepted or rejected. When the executiontype changes from the speculative execution to a non-speculativeexecution, the logic circuit can be configured to change, via thecontrol register, the state of the first and second cache sets, if thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted (e.g., when the speculative execution is tobecome the main thread of execution). And, when the execution typechanges from the speculative execution to a non-speculative execution,the logic circuit can be configured to maintain, via the controlregister, the state of the first and second cache sets without changes,if the status of speculative execution indicates that a result ofspeculative execution is to be rejected.

In some embodiments, the mapping circuit is part of or connected to thelogic circuit and the state of the control register can control a stateof a cache register of the plurality of cache registers via the mappingcircuit. In such examples, the cache system can further include aconnection to a speculation-status signal line from the processoridentifying a status of a speculative execution of instructions by theprocessor. The connection to the speculation-status signal line can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution indicates that a result of aspeculative execution is to be accepted or rejected. When the executiontype changes from the speculative execution to a non-speculativeexecution, the logic circuit can be configured to change, via thecontrol register, the state of the first and second registers, if thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted. And, when the execution type changes fromthe speculative execution to a non-speculative execution, the logiccircuit can be configured to maintain, via the control register, thestate of the first and second registers without changes, if the statusof speculative execution indicates that a result of speculativeexecution is to be rejected.

Additionally, the present disclosure includes techniques to securespeculative instruction execution using multiple interchangeable cachesthat are each interchangeable as a shadow cache or a main cache. Thespeculative instruction execution can occur in a processor of acomputing device. The processor can execute two different types ofthreads of instructions. One of the threads can be executedspeculatively (such as with a condition that has not yet beenevaluated). The data of the speculative thread can be in a logical cacheacting as a shadow cache. The data of a main thread can be in a logicalcache acting as a main cache. Subsequently, when the result ofevaluating the condition becomes available, the processor can keep theresults of executing the speculative thread when the condition requiresthe execution of the thread, or remove the results. The hardware circuitfor the cache acting as a shadow cache can be repurposed as the hardwarecircuit for the main cache by changing the content of the register.Thus, there is no need to synchronize the main cache with the shadowcache if the execution of the speculative thread is required.

The techniques disclosed herein also relate to the use of a unifiedcache structure that can be used to implement, with improvedperformance, a main cache and a shadow cache. In the unified cachestructure, results of cache sets can be dynamically remapped using a setof registers to switch being in the main cache and being in the shadowcache. When a speculative execution is successful, the cache set usedwith the shadow cache has the correct data and can be remapped as thecorresponding cache set for the main cache. This eliminates a need tocopy the data from the shadow cache to the main cache as used by othertechniques using shadow and main caches.

In general, a cache can be configured as multiple sets of blocks. Eachblock set can have multiple blocks and each block can hold a numberbytes. A memory address can be partitioned into three segments foraccessing the cache: tag, block index (which can be for addressing a setwithin the multiple sets), and cache block (which can be for addressinga byte in a block of bytes). For each block in a set, the cache storesnot only the data from the memory, but can also store a tag of theaddress from which the data is loaded and a field indicating whether thecontent in the block is valid. Data can be retrieved from the cacheusing the block index (e.g., set ID) and the cache block (e.g., byteID). The tag in the retrieved data is compared with the tag portion ofthe address. A matched tag means the data is cached for the address.Otherwise, it means that the data can be cached for another address thatis mapped to the same location in the cache.

With the techniques using multiple interchangeable caches, the physicalcache sets of the interchangeable caches are not hardwired as main cacheor shadow cache. A physical cache set can be used either as a main cacheset or a shadow cache set. And, a set of registers can be used tospecify whether the physical cache set is currently being used as a maincache set or a shadow cache set. In general, a mapping can beconstructed to translate the outputs of the physical cache sets aslogical outputs of the corresponding cache sets represented by the blockindex (e.g., set ID) and the main status or shadow status. The remappingallows any available physical cache to be used as a shadow cache.

In some embodiments, the unified cache architecture can remap a shadowcache (e.g., speculative cache) to a main cache, and can remap a maincache to a speculative cache. It is to be understood that designs caninclude any number of caches or cache sets that can interchange betweenbeing main or speculative caches or cache sets.

It is to be understood that there are no physical distinctions in thehardwiring of the main and speculative caches or cache sets. And, insome embodiments, there are no physical distinctions in the hardwiringof the logic units described herein. It is to be understood thatinterchangeable caches or cache sets do not have different cachingcapacity and structure. Otherwise, such caches or cache sets would notbe interchangeable. Also, the physical cache sets can dynamically beconfigured to be main or speculative, such as with no a prioridetermination.

Also, it is to be understood that interchangeability occurs at the cachelevel and not at the cache block level. Interchangeability at cacheblock level may allow the main cache and the shadow cache to havedifferent capacity; and thus, not be interchangeable.

Also, in some embodiments, when a speculation, by a processor, issuccessful and a cache is being used as a main cache as well as anothercache is being used as a speculative or shadow cache, the valid bitsassociated with cache index blocks of the main cache are all set toindicate invalid (e.g., indicating invalid by a “0” bit value). In suchembodiments, the initial states of all the valid bits of the speculativecache are indicative of invalid but then changed to indicate valid sincethe speculation was successful. In other words, the previous state ofthe main cache is voided, and the previous state of the speculativecache is set from invalid to valid and accessible by a main thread.

In some embodiments, a PLSM register for the main cache can be changedfrom indicating the main cache to indicating the speculative cache. Thechange in the indication, by the PLSM register, of the main cache to thespeculative cache can occur by the PLSM register receiving a valid bitof the main cache which indicates invalid after a successfulspeculation. For example, after a successful speculation and where afirst cache is initially a main cache and a second cache is initially aspeculative cache, an invalid indication of bit “0” can replace a leastsignificant bit in a 3-bit PLSM register for the first cache, which canchange “011” to “010” (or “3” to “2”). And, for a 3-bit PLSM registerfor the second cache, a valid indication of bit “1” can replace a leastsignificant bit in the PLSM register, which can change “010” to “011”(or “2” to “3”). Thus, as shown by the example, a PLSM register, whichis initially for a first cache (e.g., main cache) and initiallyselecting the first cache, is changed to selecting the second cache(e.g., speculative cache) after a successful speculation. And, as shownby the example, a PLSM register, which is initially for a second cache(e.g., speculative cache) and initially selecting the second cache, ischanged to selecting the first cache (e.g., main cache) after asuccessful speculation. With such a design, a main thread of theprocessor can first access a cache initially designated as a main cacheand then access a cache initially designated as a speculative cacheafter a successful speculation by the processor. And, a speculativethread of the processor can first access a cache initially designated asa speculative cache and then access a cache initially designated as amain cache after a successful speculation by the processor.

FIG. 1A shows a memory address 102 a partitioned into a tag part 104 a,a block index part 106 a, and a block offset part 108 a. The executiontype 110 a can be combined with the parts of the memory addresses tocontrol cache operations in accordance with some embodiments of thepresent disclosure. The total bits used to control the addressing in acache system according to some embodiments disclosed herein is A bits.And, the sum of the bits for the parts 104 a, 106 a and 108 a and theexecution type 110 a equals the A bits. Tag part 104 a is K bits, theblock index part 106 a is L bits, the block offset part 108 a is M bits,and the execution type 110 a is one or more T bits.

For example, data of all memory addresses having the same block indexpart 106 a and block offset part 108 a can be stored in the samephysical location in a cache for a given execution type. When the dataat the memory address 102 a is stored in the cache, tag part 104 a isalso stored for the block containing the memory address to identifywhich of the addresses having the same block index part 106 a and blockoffset part 108 a is currently being cached at that location in thecache.

The data at a memory address can be cached in different locations in aunified cache structure for different types of executions. For example,the data can be cached in a main cache during non-speculative execution;and subsequent cached in a shadow cache during speculative execution.Execution type 110 a can be combined with the tag part 104 a to selectfrom caches that can be dynamically configured for use in main andspeculative executions without restriction. There can be many differentways to implement the use of the combination of execution type 110 a andtag part 104 a to make the selection. For example, logic circuit 206depicted in FIGS. 2 and 4 can use the execution type 110 a and/or thetag part 104 a

In a relatively simple implementation, the execution type 110 a can becombined with the tag part 104 a to form an extended tag in determiningwhether a cache location contains the data for the memory address 102 aand for the current type of execution of instructions. For example, acache system can use the tag part 104 a to select a cache locationwithout distinction of execution types; and when the tag part 104 a iscombined with the execution type 110 a to form an extended tag, theextended tag can be used in a similar way to select a cache location inexecutions that have different types (e.g., speculative execution andnon-speculative execution), such that the techniques of shadow cache canbe implemented to enhance security. Also, since the information aboutthe execution type associated with cached data is shared among manycache locations (e.g., in a cache set, or in a cache having multiplecache sets), it is not necessary to store the execution type forindividual locations; and a selection mechanism (e.g., a switch, afilter, or a multiplexor such as a data multiplexor) can be used toimplement the selection according to the execution type). Alternatively,the physical caches or physical cache sets used for different types ofexecutions can be remapped to logical caches pre-associated with thedifferent types of executions respectively. Thus, the use of the logicalcaches can be selected according to the execution type 110 a.

FIG. 1B shows another way to partition a memory address 102 bpartitioned into parts to control cache operations. The memory address102 b is partitioned into a tag part 104 b, a cache set index part 112b, a block index part 106 b, and a block offset part 108 b. The totalbits of the memory address 102 b is A bits. And, the sum of the bits forthe four parts equals the A bits of the address 102 b. Tag part 104 b isK bits, the block index part 106 b is L bits, the block offset part 108b is M bits, and the cache set index part 112 b is S bits. Thus, foraddress 102 b, its A bits=K bits+L bits+M bits+S bits. The partition ofa memory address 102 b according to FIG. 1B allows the implementation ofset associativity in caching data.

For example, a plurality of cache sets can be configured in a cache,where each cache set can be addressed using cache set index 112 b. Adata set associated with the same cache set index can be cached in asame cache set. The tag part 104 b of a data block cached in the cacheset can be stored in the cache in association with the data block. Whenthe address 102 b is used to retrieve data from the cache set identifiedusing the cache set index 112 b, the tag part of the data block storedin the cache set can be retrieved and compared with the tag part 104 bto determine whether there is a match between the tag 104 b of theaddress 102 b of the access request and the tag 104 b stored in thecache set identified by the cache set index 112 b and stored for thecache block identified by the block index 106 b. If there is a match(such as a cache hit), the cache block stored in the cache set is forthe memory address 112 b; otherwise, the cache block stored in the cacheset is for another the memory address that has the same cache set index112 b and the same block index 106 b as the memory address 102 b, whichresults in a cache miss. In response to a cache miss, the cache systemaccesses the main memory to retrieve the data block according to theaddress 102 b. To implement shadow cache techniques, the cache set index112 b can be combined with the execution type 110 a to form an extendedcache set index. Thus, cache sets used for different types of executionsfor different cache set indices can be addressed using the extendedcache set index that identifies both the cache set index and theexecution type.

In FIG. 1B, a cache set index part 112 b is extracted from apredetermined portion of the address 102 b. Data stored at memoryaddresses having different set indices can be cached in different cachesets of a cache to implement set associativity in caching data. A cacheset of a cache can be selected using the cache set index (e.g., part 112b of the address 102 b). Alternatively, cache set associativity can beimplemented via tag 104 c that includes a cache set indicator using apartition scheme illustrated in FIG. 1C. Optionally, the cache setindicator is computed from tag 104 c and used as a cache set index toaddress a cache set. Alternatively, set associativity can be implementeddirectly via tag 104 c such that a cache set storing the tag 104 c isselected for a cache hit; and when no cache set stores the tag 104 c, acache miss is determined. Alternatively, an address 102 d can bepartition in a way as illustrated in FIG. 1D for cache operations, wheretag part 104 d includes a cache set index 112 d, where the cache setsare not explicitly and separately addressed using cache set index. Forexample, to implement shadow cache techniques, the combination ofexecution type 110 e and tag 104 e (depicted in FIG. 1E) with anembedded cache set indicator can be used to select a cache set that isfor the correct execution type and that stores the same tag 104 e for acache hit. When no cache set has a matching execution type and storingthe same tag 104 e, a cache miss is determined.

Also, as shown in FIG. 1C, FIG. 1C depicts another way to partition amemory address 102 c partitioned into parts to control cache operations.The memory address 102 c is partitioned into a tag part 104 c having acache set indicator, a block index part 106 c, and a block offset part108 c. The total bits of the memory address 102 c is A bits. And, thesum of the bits for the three parts equals the A bits of the address 102c. Tag part 104 c is K bits, the block index part 106 c is L bits, andthe block offset part 108 c is M bits. Thus, for address 102 c, its Abits=K bits+L bits+M bits. As mentioned, the partition of a memoryaddress 102 c according to FIG. 1C allows the implementation of setassociativity in caching data.

Also, as shown in FIG. 1D, FIG. 1D depicts another way to partition amemory address 102 d partitioned into parts to control cache operations.The memory address 102 d is partitioned into a tag part 104 d having acache set index 112 d, a block index part 106 d, and a block offset part108 d. The total bits of the memory address 102 d is A bits. And, thesum of the bits for the three parts equals the A bits of the address 102d. Tag part 104 d is K bits, the block index part 106 d is L bits, andthe block offset part 108 d is M bits. Thus, for address 102 d, its Abits=K bits+L bits+M bits. As mentioned, the partition of a memoryaddress 102 d according to FIG. 1D allows the implementation of setassociativity in caching data.

Also, as shown in FIG. 1E, FIG. 1E depicts another way to partition amemory address 102 e partitioned into parts to control cache operations.FIG. 1E shows a memory address 102 e partitioned into a tag part 104 ehaving a cache set indicator, a block index part 106 e, and a blockoffset part 108 e. The execution type 110 e can be combined with theparts of the memory addresses to control cache operations in accordancewith some embodiments of the present disclosure. The total bits used tocontrol the addressing in a cache system according to some embodimentsdisclosed herein is A bits. And, the sum of the bits for the parts 104e, 106 e and 108 e and the execution type 110 e equals the A bits. Tagpart 104 e is K bits, the block index part 106 e is L bits, the blockoffset part 108 e is M bits, and the execution type 110 e is T bit(s).

FIGS. 2, 3A, and 3B show example aspects of example computing devices,each computing device including a cache system having cachesinterchangeable for first type and second type executions (e.g., forimplementation of shadow cache techniques in enhancing security), inaccordance with some embodiments of the present disclosure.

FIG. 2 specifically shows aspects of an example computing device thatincludes a cache system 200 having multiple caches (e.g., see caches 202a, 202 b, and 202 c). The example computing device is also shown havinga processor 201 and a memory system 203. The cache system 200 isconfigured to be coupled between the processor 201 and a memory system203.

The cache system 200 is shown including a connection 204 a to a commandbus 205 a coupled between the cache system and the processor 201. Thecache system 200 is shown including a connection 204 b to an address bus205 b coupled between the cache system and the processor 201. Addresses102 a, 102 b, 102 c, 102 d, and 102 e depicted in FIGS. 1A, 1B, 1C, 1D,and 1E, respectively, can each be communicated via the address bus 205 bdepending on the implementation of the cache system 200. The cachesystem 200 is also shown including a connection 204 c to a data bus 205c coupled between the cache system and the processor 201. The cachesystem 200 is also shown including a connection 204 d to anexecution-type signal line 205 d from the processor 201 identifying anexecution type.

Not shown in FIG. 2, the cache system 200 can include a configurabledata bit. The configurable data bit can be included in or be data 312shown in a first state in FIG. 3A and can be included in or be data 314shown in a second state in FIG. 3B. Memory access requests from theprocessor and memory use by the processor can be controlled through thecommand bus 205 a, the address bus 205 b, and the data bus 205 c.

In some embodiments, the cache system 200 can include a first cache(e.g., see cache 202 a) and a second cache (e.g., see cache 202 b). Insuch embodiments, as shown in FIG. 2, the cache system 200 can include alogic circuit 206 coupled to the processor 201. Also, in suchembodiments, the logic circuit 206 can be configured to control thefirst cache (e.g., see cache 202 a) and the second cache (e.g., seecache 202 b) based on the configurable data bit.

When the configurable data bit is in a first state (e.g., see data 312depicted in FIG. 3A), the logic circuit 206 can be configured toimplement commands received from the command bus 205 a for accessing thememory system 203 via the first cache, when the execution type is afirst type. Also, when the configurable data bit is in a first state(e.g., see data 312 depicted in FIG. 3A), the logic circuit 206 can beconfigured to implement commands received from the command bus 205 a foraccessing the memory system 203 via the second cache, when the executiontype is a second type.

When the configurable data bit is in a second state (e.g., see data 314depicted in FIG. 3B), the logic circuit 206 can be configured toimplement commands received from the command bus 205 a for accessing thememory system 203 via the second cache, when the execution type is thefirst type. Also, when the configurable data bit is in a second state(e.g., see data 314 depicted in FIG. 3B), the logic circuit 206 can beconfigured to implement commands received from the command bus 205 a foraccessing the memory system 203 via the first cache, when the executiontype is the second type.

In some embodiments, when the execution type changes from the secondtype to the first type, the logic circuit 206 is configured to togglethe configurable data bit.

Also, as shown in FIG. 2, the cache system 200 further includes aconnection 208 a to a second command bus 209 a coupled between the cachesystem and the memory system 203. The cache system 200 also includes aconnection 208 b to a second address bus 209 b coupled between the cachesystem and the memory system 203. The cache system 200 also includes aconnection 208 c to a second data bus 209 c coupled between the cachesystem and the memory system 203. When the configurable data bit is in afirst state, the logic circuit 206 is configured to provide commands tothe second command bus 209 a for accessing the memory system 203 via thefirst cache, when the execution type is a first type (such as anon-speculative type). When the configurable data bit is in a firststate, the logic circuit 206 is also configured to provide commands tothe second command bus 209 a for accessing the memory system via thesecond cache, when the execution type is a second type (such as aspeculative type).

When the configurable data bit is in a second state, the logic circuit206 is configured to provide commands to the second command bus 209 afor accessing the memory system 203 via the second cache, when theexecution type is the first type. Also, when the configurable data bitis in a second state, the logic circuit 206 is configured to providecommands to the second command bus 209 a for accessing the memory system203 via the first cache, when the execution type is the second type.

In some embodiments, the connection 204 a to the command bus 205 a isconfigured to receive a read command or a write command from theprocessor 201 for accessing the memory system 203. Also, the connection204 b to the address bus 205 b can be configured to receive a memoryaddress from the processor 201 for accessing the memory system 203 forthe read command or the write command. Also, the connection 204 c to thedata bus 205 c can be configured to communicate data to the processor201 for the processor to read the data for the read command. And, theconnection 204 c to the data bus 205 c can also be configured to receivedata from the processor 201 to be written in the memory system 203 forthe write command. Also, the connection 204 d to the execution-typesignal line 205 d can be configured to receive an identification of theexecution type from the processor 201 (such as an identification of anon-speculative or speculative type of execution performed by theprocessor).

In some embodiments, the logic circuit 206 can be configured to selectthe first cache for a memory access request from the processor 201(e.g., one of the commands received from the command bus for accessingthe memory system), when the configurable data bit is in the first stateand the connection 204 d to the execution-type signal line 205 dreceives an indication of the first type (e.g., the non-speculativetype). Also, the logic circuit 206 can be configured to select thesecond cache for a memory access request from the processor 201, whenthe configurable data bit is in the first state and the connection 204 dto the execution-type signal line 205 d receives an indication of thesecond type (e.g., the speculative type). Also, the logic circuit 206can be configured to select the second cache for a memory access requestfrom the processor 201, when the configurable data bit is in the secondstate and the connection 204 d to the execution-type signal line 205 dreceives an indication of the first type. And, the logic circuit 206 canbe configured to select the first cache for a memory access request fromthe processor 201, when the configurable data bit is in the second stateand the connection 204 d to the execution-type signal line 205 dreceives an indication of the second type.

FIG. 3A specifically shows aspects of an example computing device thatincludes a cache system (e.g., cache system 200) having multiple caches(e.g., see caches 302 and 304). The example computing device is alsoshown having a register 306 storing data 312 that can include theconfigurable bit. The register 306 can be connect to or be a part of thelogic circuit 206. In FIG. 3A, it is shown that during a first timeinstance (“Time Instance X”), the register 306 stores data 312 which canbe the configurable bit in a first state. The content 308 a receivedfrom the first cache (e.g., cache 302) during the first time instanceincludes content for a first type of execution. And, the content 310 areceived from the second cache (e.g., cache 304) during the first timeinstance includes content for a second type of execution.

FIG. 3B specifically shows aspects of an example computing device thatincludes a cache system (e.g., cache system 200) having multiple caches(e.g., see caches 302 and 304). The example computing device is alsoshown having a register 306 storing data 314 that can include theconfigurable bit. In FIG. 3B, it is shown that during a second timeinstance (“Time Instance Y”), the register 306 stores data 314 which canbe the configurable bit in a second state. The content 308 b receivedfrom the first cache (e.g., cache 302) during the second time instanceincludes content for the second type of execution. And, the content 310b received from the second cache (e.g., cache 304) during the secondtime instance includes content for the first type of execution.

The illustrated lines 320 connecting the register 306 to the caches 302and 304 can be a part of the logic circuit 206.

In some embodiments, instead of using a configurable bit to control useof the caches of the cache system 200, another form of data may be usedto control use of the caches of the cache system. For instance, thelogic circuit 206 can be configured to control the first cache (e.g.,see cache 202 a) and the second cache (e.g., see cache 202 b) based ondifferent data being stored in the register 306 that is not theconfigurable bit. In such an example, when the register 306 stores firstdata or is in a first state, the logic circuit can be configured to:implement commands received from the command bus for accessing thememory system via the first cache, when the execution type is a firsttype; and implement commands received from the command bus for accessingthe memory system via the second cache, when the execution type is asecond type. And, when the register 306 stores second data or is in asecond state, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system via thesecond cache, when the execution type is the first type; and implementcommands received from the command bus for accessing the memory systemvia the first cache, when the execution type is the second type.

FIGS. 4, 5A, and 5B show example aspects of example computing devices,each computing device including a cache system having interchangeablecaches for main or normal type execution (e.g., non-speculativeexecution) and speculative execution, in accordance with someembodiments of the present disclosure.

FIG. 4 specifically shows aspects of an example computing device thatincludes a cache system 400 having multiple caches (e.g., see caches 202a, 202 b, and 202 c depicted in FIG. 4). In FIG. 4, the examplecomputing device is also shown having a processor 401 and memory system203. As shown by FIG. 4, cache system 400 is similar to cache system 200but for the cache system 400 also includes a connection 402 to aspeculation-status signal line 404 from the processor 401 identifying astatus of a speculative execution of instructions by the processor 401.

Similarly, the cache system 400 is shown including connection 204 a tocommand bus 205 a coupled between the cache system and the processor401. The system 400 also includes connection 204 b to an address bus 205b coupled between the cache system and the processor 401. Addresses 102a, 102 b, 102 c, 102 d, and 102 e depicted in FIGS. 1A, 1B, 1C, 1D, and1E, respectively, can each be communicated via the address bus 205 bdepending on the implementation of the cache system 400. The system 400also includes a connection 204 c to a data bus 205 c coupled between thecache system and the processor 401. It also includes a connection 204 dto an execution-type signal line 205 d from the processor 401identifying a non-speculative execution type or a speculative executiontype. Not shown in FIG. 4, the cache system 400 can also include theconfigurable data bit. The configurable data bit can be included in orbe data 312 shown in a first state in FIG. 5A and can be included in orbe data 314 shown in a second state in FIG. 5B.

In some embodiments, the cache system 400 can include a first cache(e.g., see cache 202 a) and a second cache (e.g., see cache 202 b). Insuch embodiments, as shown in FIG. 4, the cache system 400 can include alogic circuit 406 coupled to the processor 401. Also, in suchembodiments, the logic circuit 406 can be configured to control thefirst cache (e.g., see cache 202 a) and the second cache (e.g., seecache 202 b) based on the configurable data bit. When the configurabledata bit is in a first state (e.g., see data 312 depicted in FIG. 5A),the logic circuit 406 can be configured to: implement commands receivedfrom the command bus 205 a for accessing the memory system 203 via thefirst cache, when the execution type is a non-speculative type; andimplement commands received from the command bus 205 a for accessing thememory system 203 via the second cache, when the execution type is aspeculative type. When the configurable data bit is in a second state(e.g., see data 314 depicted in FIG. 5B), the logic circuit 406 can beconfigured to implement commands received from the command bus 205 a foraccessing the memory system 203 via the second cache, when the executiontype is the non-speculative type. Also, when the configurable data bitis in a second state (e.g., see data 314 depicted in FIG. 5B), the logiccircuit 406 can be configured to implement commands received from thecommand bus 205 a for accessing the memory system 203 via the firstcache, when the execution type is the speculative type.

In some embodiments, such as shown in FIG. 4, the first type can beconfigured to indicate non-speculative execution of instructions by theprocessor. In such examples, the second type can be configured toindicate speculative execution of instructions by the processor. In suchembodiments, the cache system 400 can further include connection 402 tospeculation-status signal line 404 from the processor 401 identifying astatus of a speculative execution of instructions by the processor. Theconnection 402 to the speculation-status signal line 404 can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution can indicate that a result of aspeculative execution is to be accepted or rejected.

Also, when the execution type changes from the second type or thespeculative type to the first type or non-speculative type, the logiccircuit 406 of system 400 can be configured to toggle the configurabledata bit, if the status of speculative execution indicates that a resultof speculative execution is to be accepted. Further, when the executiontype changes from the second type or the speculative type to the firsttype or non-speculative type, the logic circuit 406 of system 400 can beconfigured to maintain the configurable data bit without changes, if thestatus of speculative execution indicates that a result of speculativeexecution is to be rejected.

FIG. 5A specifically shows aspects of an example computing device thatincludes a cache system (e.g., cache system 400) having multiple caches(e.g., see caches 302 and 304). The example computing device is alsoshown having a register 306 storing data 312 that can include theconfigurable bit. In FIG. 5A, it is shown that during a first timeinstance (“Time Instance X”), the register 306 stores data 312 which canbe the configurable bit in a first state. This is similar to FIG. 3A.except the content 502 a received from a first cache (e.g., cache 302)during the first time instance includes content for a non-speculativeexecution. And, the content 504 a received from a second cache (e.g.,cache 304) during the first time instance includes content for aspeculative execution.

FIG. 5B specifically shows aspects of an example computing device thatincludes a cache system (e.g., cache system 400) having multiple caches(e.g., see caches 302 and 304). The example computing device is alsoshown having a register 306 storing data 314 that can include theconfigurable bit. In FIG. 5B, it is shown that during a second timeinstance (“Time Instance Y”), the register 306 stores data 314 which canbe the configurable bit in a second state. This is similar to FIG. 3B.except the content 502 b received from the first cache (e.g., cache 302)during the second time instance includes content for the speculativeexecution. And, the content 504 b received from the second cache (e.g.,cache 304) during the second time instance includes content for thenon-speculative execution.

Also, similarly, in FIGS. 5A and 5B, the illustrated lines 320connecting the register 306 to the caches 302 and 304 can be a part ofthe logic circuit 406 of the cache system 400.

In some embodiments, instead of using a configurable bit to control useof the caches of the cache system 400, another form of data may be usedto control use of the caches of the cache system 400. For instance, thelogic circuit 406 in the system 400 can be configured to control thefirst cache (e.g., see cache 202 a) and the second cache (e.g., seecache 202 b) based on different data being stored in the register 306that is not the configurable bit. In such an example, when the register306 stores first data or is in a first state, the logic circuit can beconfigured to: implement commands received from the command bus foraccessing the memory system via the first cache, when the execution typeis a non-speculative type; and implement commands received from thecommand bus for accessing the memory system via the second cache, whenthe execution type is a speculative type. And, when the register 306stores second data or is in a second state, the logic circuit can beconfigured to: implement commands received from the command bus foraccessing the memory system via the second cache, when the executiontype is the non-speculative type; and implement commands received fromthe command bus for accessing the memory system via the first cache,when the execution type is the speculative type.

Some embodiments can include a cache system and the cache system caninclude a plurality of caches including a first cache and a secondcache. The system can also include a connection to a command bus,configured to receive a read command or a write command from a processorconnected to the cache system, for reading from or writing to a memorysystem. The system can also include a connection to an address bus,configured to receive a memory address from the processor for accessingthe memory system for the read command or the write command. The systemcan also include a connection to a data bus, configured to: communicatedata to the processor for the processor to read the data for the readcommand; and receive data from the processor to be written in the memorysystem for the write command. In such examples, the memory accessrequests from the processor and memory used by the processor can bedefined by the command bus, the address bus, and the data bus). Thesystem can also include an execution-type signal line, configured toreceive an identification of execution type from the processor. Theexecution type is either a first execution type or a second executiontype (e.g., a normal or non-speculative execution or a speculativeexecution).

The system can also include a configurable data bit configured to be setto a first state (e.g., “0”) or a second state (e.g., “1) to controlselection of the first cache and the second cache for use by theprocessor).

The system can also include a logic circuit, configured to select thefirst cache for use by the processor, when the configurable data bit isin a first state and the execution-type signal line receives anindication of the first type of execution. The logic circuit can also beconfigured to select the second cache for use by the processor, when theconfigurable data bit is in the first state and the execution-typesignal line receives an indication of the second type of execution. Thelogic circuit can also be configured to select the second cache for useby the processor, when the configurable data bit is in the second stateand the execution-type signal line receives an indication of the firsttype of execution. The logic circuit can also be configured to selectthe first cache for use by the processor, when the configurable data bitis in the second state and the execution-type signal line receives anindication of the second type of execution.

In some embodiments, the first type of execution is a speculativeexecution of instructions by the processor, and the second type ofexecution is a non-speculative execution of instructions by theprocessor (e.g., a normal or main execution). In such examples, thesystem can further include a connection to a speculation-status signalline that is configured to receive speculation status from theprocessor. The speculation status can be either an acceptance or arejection of a condition with nested instructions that are executedinitially by a speculative execution of the processor and subsequentlyby a normal execution of the processor when the speculation status isthe acceptance of the condition.

In some embodiments, the logic circuit is configured to switch theconfigurable data bit from the first state to the second state, when thespeculation status received by the speculation-status signal line is theacceptance of the condition. The logic circuit can also be configured tomaintain the state of the configurable data bit, when the speculationstatus received by the speculation-status signal line is the rejectionof the condition.

In some embodiments, the logic circuit is configured to select thesecond cache for use as identified by the first state of theconfigurable data bit and restrict the first cache from use asidentified by the first state of the configurable data bit, when thesignal received by the execution-type signal line changes from anindication of a normal execution to an indication of a speculativeexecution. At this change, a speculation status can be ignored/bypassedby the logic circuit because the processor is in speculative executiondoes not know whether the instructions preformed under the speculativeexecution should be executed or not by the main execution.

The logic circuit can also be configured to maintain the first state ofthe configurable data bit and select the first cache for a memory accessrequest when the execution-type signal line receives an indication of anormal execution, when the signal received by the execution-type signalline changes from the indication of the speculative execution to theindication of the normal execution and when the speculation statusreceived by the speculation-status signal line is the rejection of thecondition.

In some embodiments, the logic circuit is configured to invalidate anddiscard the contents of the second cache, when the signal received bythe execution-type signal line changes from the indication of thespeculative execution to the indication of the normal execution and whenthe speculation status received by the speculation-status signal line isthe rejection of the condition.

In some embodiments, the system further includes a connection to asecond command bus, configured to communicate a read command or a writecommand to the memory system (e.g., including main memory). The readcommand or the write command can be received from the processor by thecache system. The system can also include a connection to a secondaddress bus, configured to communicate a memory address to the memorysystem. The memory address can be received from the processor by thecache system. The system can also include a connection to a second databus, configured to: communicate data to the memory system to be writtenin the memory system; and receive data from the memory system to becommunicated to the processor to be read by the processor. For instance,memory access requests to the memory system from the cache system can bedefined by the second command bus, the second address bus, and thesecond data bus.

In some embodiments, when the configurable data bit is in a first state,the logic circuit is configured to: provide commands to the secondcommand bus for accessing the memory system via the first cache, whenthe execution type is a first type; and provide commands to the secondcommand bus for accessing the memory system via the second cache, whenthe execution type is a second type. And, when the configurable data bitis in a second state, the logic circuit can be configured to: providecommands to the second command bus for accessing the memory system viathe second cache, when the execution type is the first type; and providecommands to the second command bus for accessing the memory system viathe first cache, when the execution type is the second type.

Some embodiments can include a system including a processor, a memorysystem, and a cache system coupled between the processor and the memorysystem. The cache system of the system can include a plurality of cachesincluding a first cache and a second cache. The cache system of thesystem can also include a connection to a command bus coupled betweenthe cache system and the processor, a connection to an address buscoupled between the cache system and the processor, a connection to adata bus coupled between the cache system and the processor, and aconnection to an execution-type signal line from the processoridentifying an execution type.

The cache system of the system can also include a configurable data bitand a logic circuit coupled to the processor to control the first cacheand the second cache based on the configurable data bit. When theconfigurable data bit is in a first state, the logic circuit can beconfigured to: implement commands received from the command bus foraccessing the memory system via the first cache, when the execution typeis a first type; and implement commands received from the command busfor accessing the memory system via the second cache, when the executiontype is a second type. And, when the configurable data bit is in asecond state, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system via thesecond cache, when the execution type is the first type; and implementcommands received from the command bus for accessing the memory systemvia the first cache, when the execution type is the second type.

In such a system, the first type can be configured to indicatenon-speculative execution of instructions by the processor, and thesecond type can be configured to indicate speculative execution ofinstructions by the processor. Also, the cache system of the system canfurther include a connection to a speculation-status signal line fromthe processor identifying a status of a speculative execution ofinstructions by the processor. The connection to the speculation-statussignal line can be configured to receive the status of a speculativeexecution, and the status of a speculative execution can indicate that aresult of a speculative execution is to be accepted or rejected. Whenthe execution type changes from the second type (speculative type) tothe first type (non-speculative type), the logic circuit can beconfigured to toggle the configurable data bit, if the status ofspeculative execution indicates that a result of speculative executionis to be accepted. And, when the execution type changes from the secondtype (speculative type) to the first type (non-speculative type), thelogic circuit can also be configured to maintain the configurable databit without changes, if the status of speculative execution indicatesthat a result of speculative execution is to be rejected.

FIGS. 6, 7A, 7B, 8A, 8B, 9A, and 9B show example aspects of examplecomputing devices, each computing device including a cache system havinginterchangeable cache sets for first type and second type executions(e.g., for implementation of shadow cache techniques in enhancingsecurity and/or for main type and speculative type executions), inaccordance with some embodiments of the present disclosure.

FIG. 6 specifically shows aspects of an example computing device thatincludes a cache system 600 having multiple caches (e.g., see caches 602a, 602 b, and 602 c), where at least one of the caches is implementedwith cache set associativity. The example computing device is also shownhaving a processor 601 and a memory system 603. The cache system 600 isconfigured to be coupled between the processor 601 and a memory system603.

The cache system 600 is shown including a connection 604 a to a commandbus 605 a coupled between the cache system and the processor 601. Thecache system 600 is shown including a connection 604 b to an address bus605 b coupled between the cache system and the processor 601. Addresses102 a, 102 b, 102 c, 102 d, and 102 e depicted in FIGS. 1A, 1B, 1C, 1D,and 1E, respectively, can each be communicated via the address bus 605 bdepending on the implementation of the cache system 600. The cachesystem 600 is also shown including a connection 604 c to a data bus 605c coupled between the cache system and the processor 601. The cachesystem 600 is also shown including a connection 604 d to anexecution-type signal line 605 d from the processor 601 identifying anexecution type. The connections 604 a, 604 b, 604 c, and 604 d canprovide communicative couplings between the busses 605 a, 605 b, 605 c,and 605 d and a logic circuit 606 of the cache system 600.

Also, as shown in FIG. 6, the cache system 600 further includes aconnection 608 a to a second command bus 609 a coupled between the cachesystem and the memory system 603. The cache system 600 also includes aconnection 608 b to a second address bus 609 b coupled between the cachesystem and the memory system 603. The cache system 600 also includes aconnection 608 c to a second data bus 609 c coupled between the cachesystem and the memory system 603.

The cache system 600 also includes a plurality of cache sets (e.g., seecache sets 610 a, 610 b, and 610 c). The caches sets can include a firstcache set (e.g., see cache set 610 a) and a second cache set (e.g., seecache set 610 b).

Also, as shown in FIG. 6, the cache system 600 further includes aplurality of registers (e.g., see registers 612 a, 612 b, and 612 c)associated with the plurality of cache sets respectively. The registers(or cache set registers) can include a first register (e.g., seeregister 612 a) associated with the first cache set (e.g., see cache set610 a) and a second register (e.g., see register 612 a) associated withthe second cache set (e.g., see cache set 610 b). Each one of theplurality of registers (e.g., see registers 612 a, 612 b, and 612 c) canbe configured to store a set index.

As shown in FIG. 6 as well as FIG. 10, cache 602 a and cache 602 b tocache 602 c (caches 1 to N) are not fixed structures. However, it is tobe understood that in some embodiments the caches can be fixedstructures. Each of the depicted caches can be considered a logicalgrouping of cache sets and such logical grouping is shown by brokenlines representing each logical cache. The cache sets 610 a to 610 c(cache sets 1 to N) can be based on the content of the registers 610 ato 610 c (registers 1 to N). Cache sets 1 to N can be a collection ofcache sets within the cache system shared among cache 1, and cache 2 tocache N. Cache 1 can be a subset of the collection; cache 2 can beanother non-overlapping subset. The member cache sets in each of thecaches can change based on the contents in the registers 1 to N.

Cache set 1 (in a conventional sense) may or may not communicate withits register 1 depending on the embodiment. Broken lines are also shownin FIGS. FIGS. 7A, 7B, 8A, 8B, 9A, and 9B to indicate the logicalrelation between the cache sets and corresponding registers in FIGS. 7A,7B, 8A, 8B, 9A, and 9B. The content of the register 1 determines howcache set 1 is addressed (e.g., what cache set index will cause thecache set 1 to be selected to output data). In some embodiments, thereis no direct interaction between a cache set 1 and its correspondingregister 1. The logic circuit 606 or 1006 interacts with both the cacheset and the corresponding register depending on the embodiment.

In some embodiments, the logic circuit 606 can be coupled to theprocessor 601 to control the plurality of cache sets (e.g., cache sets610 a, 610 b, and 610 c) according to the plurality of registers (e.g.,registers 612 a, 612 b, and 612 c). In such embodiments, the cachesystem 600 can be configured to be coupled between the processor 601 anda memory system 603. And, when the connection 604 b to the address bus605 b receives a memory address from the processor 601, the logiccircuit 606 can be configured to generate a set index from at least thememory address and determine whether the generated set index matcheswith content stored in the first register (e.g., register 612 a) or withcontent stored in the second register (e.g., register 612 b). The logiccircuit 606 can also be configured to implement a command received inthe connection 604 a to the command bus 605 a via the first cache set(e.g., cache set 610 a) in response to the generated set index matchingwith the content stored in the first register (e.g., register 612 a) andvia the second cache set (e.g., cache set 610 b) in response to thegenerated set index matching with the content stored in the secondregister (e.g., register 612 b).

In some embodiments, the cache system 600 can include a first cache(e.g., see cache 602 a) and a second cache (e.g., see cache 602 b). Insuch embodiments, as shown in FIG. 2, the cache system 600 can include alogic circuit 606 coupled to the processor 601. Also, in suchembodiments, the logic circuit 606 can be configured to control thefirst cache (e.g., see cache 602 a) and the second cache (e.g., seecache 602 b) based on a configurable data bit and/or respectiveregisters (e.g., see registers 612 a, 612 b, and 612 c).

In some embodiments, in response to a determination that a data set ofthe memory system 603 associated with the memory address is notcurrently cached in the cache system 600 (such as not cached in cache602 a of the system), the logic circuit 606 is configured to allocatethe first cache set (e.g., cache set 610 a) for caching the data set andstore the generated set index in the first register (e.g., register 612a). In such embodiments and others, the cache system can include aconnection to an execution-type signal line (e.g., connection 604 d toexecution-type signal line 605) from the processor (e.g., processor 601)identifying an execution type. And, in such embodiments and others, thegenerated set index is generated further based on a type identified bythe execution-type signal line. Also, the generated set index caninclude a predetermined segment of bits in the memory address and a bitrepresenting the type identified by the execution-type signal line 605d.

Also, when the first and second registers (e.g., registers 612 a and 612b) are in a first state, the logic circuit 606 can be configured toimplement commands received from the command bus 605 a for accessing thememory system 601 via the first cache set (e.g., cache set 610 a), whenthe execution type is a first type. Also, when the first and secondregisters (e.g., registers 612 a and 612 b) are in a first state, thelogic circuit 606 can be configured to implement commands received fromthe command bus 605 a for accessing the memory system 601 via the secondcache set (e.g., cache set 610 b), when the execution type is a secondtype.

Furthermore, when the first and second registers (e.g., registers 612 aand 612 b) are in a second state, the logic circuit 606 can beconfigured to implement commands received from the command bus 605 a foraccessing the memory system 601 via another cache set of the pluralityof cache sets besides the first cache set (e.g., cache set 610 b or 610c), when the execution type is the first type. Also, when the first andsecond registers (e.g., registers 612 a and 612 b) are in a secondstate, the logic circuit 606 can be configured to implement commandsreceived from the command bus 605 a for accessing the memory system 601via another other cache set of the plurality of cache sets besides thesecond cache set (e.g., cache set 610 a or 610 c or another cache setnot depicted in FIG. 6), when the execution type is the second type.

In some embodiments, each one of the plurality of registers (e.g., seeregisters 612 a, 612 b, and 612 c) can be configured to store a setindex, and when the execution type changes from the second type to thefirst type (e.g., from the non-speculative type to the speculative typeof execution), the logic circuit 606 can be configured to change thecontent stored in the first register (e.g., register 612 a) and thecontent stored in the second register (e.g., register 612 b). Examplesof the change of the content stored in the first register (e.g.,register 612 a) and the content stored in the second register (e.g.,register 612 b) are illustrated in FIGS. 7A and 7B, FIGS. 8A and 8B, andFIGS. 9A and 9B.

Each of FIGS. 7A, 7B, 8A, 8B, 9A, and 9B, specifically shows aspects ofan example computing device that includes a cache system having multiplecache sets (e.g., see caches 702, 704, and 706), where the cache setsare implemented via cache set associativity. The respective cache systemfor each of these figures is also shown having a plurality of registersassociated with the cache sets respectively. The plurality of registersincludes at least register 712, register 714, and register 716. Theplurality of registers includes at least one additional register whichis not shown in the figures. Register 712 is shown being associated withor connected to cache set 702, register 714 is shown being associatedwith or connected to cache set 704, and register 716 is shown beingassociated with or connected to cache set 706.

Not shown in FIGS. 7A, 7B, 8A, 8B, 9A, and 9B, each of the respectivecache systems can also include a connection to a command bus coupledbetween the cache system and a processor, a connection to an address buscoupled between the cache system and the processor, and a connection toa data bus coupled between the cache system and the processor. Each ofthe cache systems can also include a logic circuit coupled to theprocessor to control the plurality of cache sets (e.g., cache sets 702,704, and 706) according to the plurality of registers (e.g., registers712, 714, and 716).

As illustrated by FIGS. 7A, 7B, 8A, 8B, 9A, and 9B, when a connection toan address bus of a cache system receives a memory address (e.g., seememory address 102 b, 102 c, or 102 d) from a processor, a logic circuitof the cache system can be configured to generate a set index (e.g., seeset index 722, 724, 726, or 728) from the memory address (e.g., see setindex generation 730, 732, 830, 832, 930, or 932).

Specifically, as shown in FIG. 7A, at least the registers 712, 714, and716 are configured in a first state. When a connection to an address busof the cache system receives the memory address 102 b from a processor,a logic circuit of the cache system generates set index 722, 724 or 726according to at least set index generation 730 a, 730 b, or 730 crespectively and an instance of cache set index 112 b of address 102 b.The set index generation 730 a, 730 b, or 730 c can be for storing theset index 722, 724 or 726 in register 712, 714, or 716 respectively. Theset index generation 730 a, 730 b, or 730 c can also be for usage of therecently generated set index in a comparison of the recently generatedset index to content already stored in register 712, 714, or 716respectively. The set index generations 730 a, 730 b, and 730 c occurwhen the registers are configured in the first state. The configurationof the first state can be through set index generation and storage.

Specifically, as shown in FIG. 7B, at least the registers 712, 714, and716 are configured in a second state. When the connection to the addressbus of the cache system receives the memory address 102 b from theprocessor, the logic circuit of the cache system generates set index726, 722 or 728 according to at least set index generation 732 a, 732 b,or 732 c respectively and an instance of cache set index 112 b ofaddress 102 b. The set index generation 732 a, 732 b, or 732 c can befor storing the set index 726, 722 or 728 in register 712, 714, or 716respectively. The set index generation 732 a, 732 b, or 732 c can alsobe for usage of the recently generated set index in a comparison of therecently generated set index to content already stored in register 712,714, or 716 respectively. The set index generations 732 a, 732 b, and732 c occur when the registers are configured in the second state. Theconfiguration of the second state can be through set index generationand storage.

Specifically, as shown in FIG. 8A, at least the registers 712, 714, and716 are configured in a first state. When a connection to an address busof the cache system receives the memory address 102 c from a processor,a logic circuit of the cache system generates set index 722, 724 or 726according to at least set index generation 830 a, 830 b, or 830 crespectively and an instance of tag 104 c of address 102 b having acache set indicator. The set index generation 830 a, 830 b, or 830 c canbe for storing the set index 722, 724 or 726 in register 712, 714, or716 respectively. The set index generation 830 a, 830 b, or 830 c canalso be for usage of the recently generated set index in a comparison ofthe recently generated set index to content already stored in register712, 714, or 716 respectively. The set index generations 830 a, 830 b,and 830 c occur when the registers are configured in the first state.

Specifically, as shown in FIG. 8B, at least the registers 712, 714, and716 are configured in a second state. When the connection to the addressbus of the cache system receives the memory address 102 c from theprocessor, the logic circuit of the cache system generates set index726, 722 or 728 according to at least set index generation 832 a, 832 b,or 832 c respectively and an instance of tag 104 c of address 102 bhaving a cache set indicator. The set index generation 832 a, 832 b, or832 c can be for storing the set index 726, 722 or 728 in register 712,714, or 716 respectively. The set index generation 832 a, 832 b, or 832c can also be for usage of the recently generated set index in acomparison of the recently generated set index to content already storedin register 712, 714, or 716 respectively. The set index generations 832a, 832 b, and 832 c occur when the registers are configured in thesecond state.

Specifically, as shown in FIG. 9A, at least the registers 712, 714, and716 are configured in a first state. When a connection to an address busof the cache system receives the memory address 102 d from a processor,a logic circuit of the cache system generates set index 722, 724 or 726according to at least set index generation 930 a, 930 b, or 930 crespectively and an instance of cache set index 112 d in tag 104 d ofaddress 102 b. The set index generation 930 a, 930 b, or 930 c can befor storing the set index 722, 724 or 726 in register 712, 714, or 716respectively. The set index generation 930 a, 930 b, or 930 c can alsobe for usage of the recently generated set index in a comparison of therecently generated set index to content already stored in register 712,714, or 716 respectively. The set index generations 930 a, 930 b, and930 c occur when the registers are configured in the first state.

Specifically, as shown in FIG. 7B, at least the registers 712, 714, and716 are configured in a second state. When the connection to the addressbus of the cache system receives the memory address 102 d from theprocessor, the logic circuit of the cache system generates set index726, 722 or 728 according to at least set index generation 932 a, 932 b,or 932 c respectively and an instance of cache set index 112 d in tag104 d of address 102 b. The set index generation 932 a, 932 b, or 932 ccan be for storing the set index 726, 722 or 728 in register 712, 714,or 716 respectively. The set index generation 932 a, 932 b, or 932 c canalso be for usage of the recently generated set index in a comparison ofthe recently generated set index to content already stored in register712, 714, or 716 respectively. The set index generations 932 a, 932 b,and 932 c occur when the registers are configured in the second state.

In some embodiments implemented through the cache system illustrated inFIGS. 7A and 7B, 8A and 8B, or 9A and 9B, when the connection to theaddress bus receives a memory address from the processor, the logiccircuit can be configured to determine whether the generated set indexmatches with content stored in one of the registers (e.g., registers712, 714, and 716). The content stored in the register can be from aprior generation of a set index and storage of the set index in theregister.

Also, in some embodiments implemented through the cache systemillustrated in FIGS. 7A and 7B, 8A and 8B, or 9A and 9B, the logiccircuit can be configured to implement a command received in theconnection to the command bus via a first cache set in response to thegenerated set index matching with the content stored in an associatedfirst register and via a second cache set in response to the generatedset index matching with the content stored in an associated secondregister. Also, in response to a determination that a data set of thememory system associated with the memory address is not currently cachedin the cache system, the logic circuit can be configured to allocate thefirst cache set for caching the data set and store the generated setindex in the first register. The generated set index can include apredetermined segment of bits in the memory address.

Also, in such embodiments, when the first and second registers are in afirst state, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system via thefirst cache set, when an execution type of a processor is a first type;and implement commands received from the command bus for accessing thememory system via the second cache set, when the execution type is asecond type. Also, when the first and second registers are in a secondstate, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system viaanother cache set of the plurality of cache sets besides the first cacheset, when the execution type is the first type; and implement commandsreceived from the command bus for accessing the memory system viaanother other cache set of the plurality of cache sets besides thesecond cache set, when the execution type is the second type. In such anexample, each one of the plurality of registers can be configured tostore a set index, and when the execution type changes from the secondtype to the first type, the logic circuit can be configured to changethe content stored in the first register and the content stored in thesecond register.

FIG. 10 specifically shows aspects of an example computing device thatincludes a cache system 1000 having multiple caches (e.g., see caches602 a, 602 b, and 602 c depicted in FIG. 10), where at least one of thecaches is implemented with cache set associativity (e.g., see cache sets610 a, 610 b, and 601 c). In FIG. 10, the example computing device isalso shown having a processor 1001 and memory system 603. As shown byFIG. 10, cache system 1000 is similar to cache system 600 but for thecache system 1000 also includes a connection 1002 to aspeculation-status signal line 1004 from the processor 1001 identifyinga status of a speculative execution of instructions by the processor1001.

Similarly, the cache system 1000 is shown including connection 604 a tocommand bus 605 a coupled between the cache system and the processor1001. The system 1000 also includes connection 604 b to an address bus605 b coupled between the cache system and the processor 1001. Addresses102 a, 102 b, 102 c, 102 d, and 102 e depicted in FIGS. 1A, 1B, 1C, 1D,and 1E, respectively, can each be communicated via the address bus 605 bdepending on the implementation of the cache system 1000. The system1000 also includes a connection 604 c to a data bus 605 c coupledbetween the cache system and the processor 1001. It also includes aconnection 604 d to an execution-type signal line 605 d from theprocessor 1001 identifying a non-speculative execution type or aspeculative execution type.

Similarly, the cache system 1000 is also shown including logic circuit1006 which can be similar to logic circuit 606 but for its circuitrycoupled to the connection 1002 to the speculation-status signal line1004.

In some embodiments, the logic circuit 1006 can be coupled to theprocessor 1001 to control the plurality of cache sets (e.g., cache sets610 a, 610 b, and 610 c) according to the plurality of registers (e.g.,registers 612 a, 612 b, and 612 c). Each one of the plurality ofregisters (e.g., see registers 612 a, 612 b, and 612 c) can beconfigured to store a set index.

In such embodiments, the cache system 1000 can be configured to becoupled between the processor 1001 and a memory system 603. And, whenthe connection 604 b to the address bus 605 b receives a memory addressfrom the processor 1001, the logic circuit 1006 can be configured togenerate a set index from at least the memory address and determinewhether the generated set index matches with content stored in the firstregister (e.g., register 612 a) or with content stored in the secondregister (e.g., register 612 b). The logic circuit 1006 can also beconfigured to implement a command received in the connection 604 a tothe command bus 605 a via the first cache set (e.g., cache set 610 a) inresponse to the generated set index matching with the content stored inthe first register (e.g., register 612 a) and via the second cache set(e.g., cache set 610 b) in response to the generated set index matchingwith the content stored in the second register (e.g., register 612 b).

Also, the cache system 1000 is shown including connections 608 a, 608 b,and 608 c, which are similar to the corresponding connections shown inFIG. 6. With respect to the connections 608 a, 608 b, and 608 c depictedin FIGS. 6 and 10, when the first and second registers (e.g., registers612 a and 612 b) are in a first state, the logic circuit 606 or 1006 canbe configured to provide commands to the second command bus 609 a foraccessing the memory system 603 via the first cache set (e.g., cache set610 a), when the execution type is a first type (such as anon-speculative type). Also, when the first and second registers (e.g.,registers 612 a and 612 b) are in the first state, the logic circuit 606or 1006 can be configured to provide commands to the second command bus609 a for accessing the memory system via the second cache set (e.g.,cache set 610 b), when the execution type is a second type (such as aspeculative type).

Further, when the first and second registers (e.g., registers 612 a and612 b) are in a second state, the logic circuit 606 or 1006 can beconfigured to provide commands to the second command bus 609 a foraccessing the memory system 603 via a cache set other than the firstcache set (e.g., cache set 610 b or 610 c or another cache set notdepicted in FIG. 6 or 10), when the execution type is the first type.Also, when the first and second registers (e.g., registers 612 a and 612b) are in a second state, the logic circuit 606 or 1006 can beconfigured to provide commands to the second command bus 609 a foraccessing the memory system 603 via a cache set other than the secondcache set (e.g., cache set 610 a or 610 c or another cache set notdepicted in FIG. 6 or 10), when the execution type is the second type.

In some embodiments, such as shown in FIG. 10, the first type can beconfigured to indicate non-speculative execution of instructions by theprocessor 1001; and the second type can be configured to indicatespeculative execution of instructions by the processor. Shown in FIG.10, the cache system 1000 further includes connection 1002 tospeculation-status signal line 1004 from the processor 1001 identifyinga status of a speculative execution of instructions by the processor.The connection 1002 to the speculation-status signal line 1004 can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution can indicate that a result of aspeculative execution is to be accepted or rejected.

In such embodiments, each one of the plurality of registers (e.g.,registers 612 a, 612 b, and 612 c) can be configured to store a setindex, and when the execution type changes from the speculativeexecution type to the non-speculative type, the logic circuit 1006 canbe configured to change the content stored in the first register (e.g.,register 612 a) and the content stored in the second register (e.g.,register 612 b), if the status of speculative type of executionindicates that a result of the speculative execution is to be accepted.And, when the execution type changes from the speculative type to thenon-speculative type, the logic circuit 1006 can be configured tomaintain the content stored in the first register and the content storedin the second register without changes, if the status of speculativetype of execution indicates that a result of the speculative type ofexecution is to be rejected.

Some embodiments can include a cache system that includes a plurality ofcache sets having at least a first cache set and a second cache set. Thecache system can also include a plurality of registers associated withthe plurality of cache sets respectively. The plurality of registers caninclude at least a first register associated with the first cache set,configured to store a set index, and a second register associated withthe second cache set, configured to store a set index. The cache systemcan also include a connection to a command bus coupled between the cachesystem and a processor, a connection to an address bus coupled betweenthe cache system and the processor, a connection to a data bus coupledbetween the cache system and the processor, and a connection to anexecution-type signal line from the processor identifying an executiontype.

The cache system can also include a logic circuit coupled to theprocessor to control the plurality of cache sets according to theplurality of registers. And, the cache system can be configured to becoupled between the processor and a memory system. When the first andsecond registers are in a first state, the logic circuit can beconfigured to: implement commands received from the command bus foraccessing the memory system via the first cache set, when the executiontype is a first type; and implement commands received from the commandbus for accessing the memory system via the second cache set, when theexecution type is a second type. Also, when the first and secondregisters are in a second state, the logic circuit can be configured to:implement commands received from the command bus for accessing thememory system via another cache set of the plurality of cache setsbesides the first cache set, when the execution type is the first type;and implement commands received from the command bus for accessing thememory system via another other cache set of the plurality of cache setsbesides the second cache set, when the execution type is the secondtype.

The connection to the address bus can be configured to receive a memoryaddress from the processor, and the memory address can include a setindex.

In some embodiments, when the first and second registers are in a firststate, a first set index associated with the first cache set is storedin the first register, and a second set index associated with the secondcache set is stored in the second register. When the first and secondregisters are in a second state, the first set index can be stored inanother register of the plurality of registers besides the firstregister, and the second set index can be stored in another register ofthe plurality of registers besides the second register. In suchexamples, when the connection to the address bus receives a memoryaddress from the processor, the logic circuit can be configured to:generate a set index from at least the memory address; and determinewhether the generated set index matches with content stored in the firstregister or with content stored in the second register. And, the logiccircuit can be further configured to implement a command received in theconnection to the command bus via the first cache set in response to thegenerated set index matching with the content stored in the firstregister and via the second cache set in response to the generated setindex matching with the content stored in the second register.

In response to a determination that a data set of the memory systemassociated with the memory address is not currently cached in the cachesystem, the logic circuit can be configured to allocate the first cacheset for caching the data set and store the generated set index in thefirst register.

In some embodiments, the generated set index is generated further basedon an execution type identified by the execution-type signal line. Insuch examples, the generated set index can include a predeterminedsegment of bits in the memory address and a bit representing theexecution type identified by the execution-type signal line.

Some embodiments can include a system, including a processor, a memorysystem, and a cache system. The cache system can include a plurality ofcache sets, including a first cache set and a second cache set, and aplurality of registers associated with the plurality of cache setsrespectively, including a first register associated with the first cacheset and a second register associated with the second cache set. Thecache system can also include a connection to a command bus coupledbetween the cache system and the processor, a connection to an addressbus coupled between the cache system and the processor, and a connectionto a data bus coupled between the cache system and the processor.

The cache system can also include a logic circuit coupled to theprocessor to control the plurality of cache sets according to theplurality of registers. When the connection to the address bus receivesa memory address from the processor, the logic circuit can be configuredto: generate a set index from at least the memory address; and determinewhether the generated set index matches with content stored in the firstregister or with content stored in the second register. And, the logiccircuit can be configured to implement a command received in theconnection to the command bus via the first cache set in response to thegenerated set index matching with the content stored in the firstregister and via the second cache set in response to the generated setindex matching with the content stored in the second register.

The cache system can further include a connection to an execution-typesignal line from the processor identifying an execution type. Thegenerated set index can be generated further based on a type identifiedby the execution-type signal line. The generated set index can include apredetermined segment of bits in the memory address and a bitrepresenting the type identified by the execution-type signal line.

FIGS. 11A and 11B illustrate background synching circuitry forsynchronizing content between a main cache and a shadow cache to savethe content cached in the main cache in preparation of acceptance of thecontent in the shadow cache, in accordance with some embodiments of thepresent disclosure. The cache system in FIGS. 11A and 11B includesbackground syncing circuitry 1102. For example, cache 1124 and cache1126 can be caches 202 a and 202 b in FIG. 2 or 4, or caches 602 a and602 b in FIG. 6 or 10. The background syncing circuitry 1102 can be apart of the logic circuit 206, 406, 606 or 1006.

FIG. 11A illustrates a scenario where cache 1124 is used as the maincache in non-speculative execution and cache 1126 is used as a shadowcache in speculative execution. The background syncing circuitry 1102 isconfigured to synchronize 1130 the cached content from cache 1124 tocache 1126 such that if the conditional speculative execution isconfirmed to be required, cache 1126 can be used as the main cache insubsequent non-speculative execution; and, cache 1124 can be used as theshadow cache in a further instance of speculative execution. The syncing1130 of the cached content from cache 1124 to cache 1126 copies theprevious execution results into cache 1126 such that the executionresults are not lost in repurposing the cache 1124 as the shadow cachesubsequently. The cached content from cache 1124 can be cached in cache1124 but not yet flushed to memory (e.g., memory 203 or 603). Further,some of the memory content that has a same copy cached in cache 1124 canalso be copied from cache 1124 to cache 1126, such that when cache 1126is subsequently used as a main cache, the content previously cached incache 1124 is also available in cache 1126. This can speed up the accessto the previously cached content. Copying the content between the cache1124 and cache 1126 is faster than retrieving the data from the memoryto the cache system.

In some embodiments, if a program references a variable during normalexecution, the variable can be cached. In such examples, if duringspeculation the variable is referenced in a write-through cache, thevalue in main memory is valid and correct. If during speculation thevariable is referenced in a write-back cache, then the aforesaidexamples features described for FIG. 11A can be used; and the validvalue of the variable can be in the cache 1124.

In the scenario illustrated in FIG. 11A, a processor (e.g., processor201, 401, 601, or 1001) can execution a first set of instructions in themode of non-speculative execution. During the execution of the first setof instructions, the processor can access memory addresses to load data(e.g., instructions and operands) from the memory, and store computationresults. Since cache 1124 is used as the main cache, the content of thedata and/or computation results can be cached in cache 1124. Forexample, cache 1124 can store the computation results that have not yetbeen written back into the memory; and cache 1124 can store the loadeddata (e.g., instructions and operands) that may be used in subsequentexecutions of instructions.

In preparation of the cache B 1226 for use as a shadow cache in thespeculative execution of a second set of instructions, the backgroundsyncing circuitry 1102 copies the cached content from cache 1124 tocache 1126 in syncing 1130. At least part of the copying operations canbe performed in the background in a way independent from the processoraccessing the memory via the cache system. For example, when theprocessor is accessing a first memory address in the non-speculativeexecution of the first set of instructions, the background syncingcircuitry 1102 can copy the content cached in the cache 1124 for asecond memory address into the cache 1126. In some instances, thecopying operations can be performed in the background in parallel withthe accessing the memory via the cache system. For example, when theprocessor is accessing a first memory address in the non-speculativeexecution of the first set of instructions to store a computationresult, the background syncing circuitry can copy the computation resultinto the cache 1126 as cache content for the first memory address.

In one implementation, the background syncing circuitry 1102 isconfigured to complete the syncing operation before the cache 1126 isallowed to be used in the speculative execution of the second set ofinstructions. Thus, when the cache 1126 is enabled to be used for thespeculative execution of the second set of instructions, the validcontent in the cache 1124 can also be found in cache 1126. However, thesyncing operation can delay the use of the cache 1126 as the shadowcache. Alternatively, the background syncing circuitry 1102 isconfigured to prioritize the syncing of dirty content from the cache1124 to the cache 1126. Dirty content can be where the data in the cachehas been modified and the data in main memory has not be modified.

Dirty content cached in the cache 1124 can be more up to date than thecontent stored in corresponding one or more addresses in the memory. Forexample, when the processor stores a computation result at an address,the cache 1124 can cache the computation result for the address withoutimmediately writing the computation result into the memory at theaddress. When the computation result is written back to the memory atthe address, the cached content is no longer considered dirty. The cache1124 stores data to track the dirty content cached in cache 1124. Thebackground syncing circuit 1102 can automatically copy the dirty contentfrom cache 1124 to cache 1126 in preparation of cache 1126 to serve as ashadow cache.

Optionally, before the completion of the syncing operations, thebackground syncing circuitry 1102 can allow the cache 1126 to functionas a shadow cache in conditional speculative execution of the second setof instructions. During the time period in which the cache 1126 is usedin the speculative execution as a shadow cache, the background syncingcircuit 1102 can continue the syncing operation 1130 of copying cachedcontent from cache 1124 to cache 1126. The background syncing circuitry1102 is configured to complete at least the syncing of the dirty contentfrom the cache 1124 to cache 1126 before allowing the cache 1126 to beaccepted as the main cache. For example, upon the indication that theexecution of the second set of instructions is required, the backgroundsyncing circuitry 1102 determines whether the dirty content in the cache1124 has been synced to the cache 1126; and if not, the use of the cache1126 as main cache is postponed until the syncing is complete.

In some implementations, the background syncing circuitry 1102 cancontinue its syncing operation even after the cache 1126 is accepted asthe main cache, but before the cache 1124 is used as a shadow cache inconditional speculative execution of a third set of instructions.

Before the completion of the syncing operation 1130, the cache systemcan configure the cache 1124 as a secondary cache between the cache 1126and the memory during the speculative execution, such that when thecontent of a memory address is not found in cache 1126, the cache systemchecks cache 1124 to determine whether the content is in cache 1124; andif so, the content is copied from cache 1124 to cache 1126 (instead ofbeing loaded from the memory directly). When the processor stores dataat a memory address and the data is cached in cache 1126, the cachesystem checks invalidates the content that is cached in the cache 1124as a secondary cache.

After the cache 1126 is reconfigured as the main cache following theacceptance of the result of the speculative execution of the second setof instructions, the background syncing circuitry 1102 can start tosynchronize 1132 the cached content from the cache 1126 to the cache1124, as illustrated in FIG. 11B.

Following the speculative execution of the second set of instructions,if the speculative status from the processor indicates that the resultsof the execution of the second set of instructions should be rejected,the cache 1124 remains to function as the main cache; and the content inthe cache 1126 can be invalidated. The invalidation can include thecache 1126 has all its entries marked empty; thus, any subsequentspeculations begin with an empty speculative cache.

The background syncing circuitry 1102 can again synchronize 1130 thecached content from the cache 1124 to the cache 1126 in preparation ofthe speculative execution of the third set of instructions.

In some embodiments, each of the cache 1124 and cache 1126 has adedicated and fixed collection of cache sets; and a configurable bit isused to control use of the caches 1124 and 1126 as main cache and shadowcache respectively, as illustrated in FIGS. 3A, 3B, 5A, and 5B.

In other embodiments, cache 1124 and cache 1126 can share a pool ofcache sets, some of the cache sets can be dynamically allocated to cache1124 and cache 1126, as illustrated in FIGS. 6 to 10. When the cache1124 is used as the main cache and the cache 1126 is used as the shadowcache, the cache 1126 can have a smaller number of cache sets than thecache 1124. Some of the cache sets in cache 1126 can be the shadows of aportion of the cache sets in the cache 1124 such that when the result ofthe speculative execution is determined to be accepted, the portion ofthe cache sets in the cache 1124 can be reconfigured for use as shadowcache in the next speculative execution; and the remaining portion ofthe cache sets that is not affected by the speculative execution can bere-allocated from the cache 1124 to the cache 1126, such that the cachedcontent in the unaffected portion can be further used in the subsequentnon-speculative execution.

FIG. 12 show example operations of the background syncing circuitry 1102of FIGS. 11A and 11B, in accordance with some embodiments of the presentdisclosure.

As shown in FIG. 12, at operation 1202, a cache system configures afirst cache as main cache and a second cache as shadow cache. Forexample, when dedicated caches with fixed hardware structures are usedas the first cache and the second cache, a configurable bit can be usedto configure the first cache as main cache and the second cache asshadow cache, as illustrated in FIGS. 2 to 5B. Alternatively, cache setscan be allocated from a pool of cache sets, using registers, to and fromthe first cache and the second cache, in a way as illustrated in FIGS. 6to 10.

At operation 1204, the cache system determines whether the currentexecution type is changed from non-speculative to speculative. Forexample, when the processor accesses the memory via the cache system200, the processor further provides the indication of whether thecurrent memory access is associated with conditional speculativeexecution. For example, the indication can be provided in a signal line205 d configured to specify execution type.

If the current execution type is not changed from non-speculative tospeculative, the cache system services memory access requests from theprocessor using the first cache as the main cache at operation 1206.When the memory access changes the cached content in the first cache,the background syncing circuitry 1102 can copy the content cached in thefirst cache to the second cache in operation 1208. For example, thebackground syncing circuitry 1102 can be part of the logic circuit 206in FIG. 2, 406 in FIG. 4, 606 in FIG. 6, and/or 1006 in FIG. 10. Thebackground syncing circuitry 1102 can prioritize the copy of dirtycontent cached in the first cache.

In FIG. 12, the operations 1204 to 1208 are repeated until the cachesystem 200 determines that the current execution type is changed tospeculative.

Optionally, the background syncing circuitry 1102 is configured tocontinue copying content cached in the first cache to the second cacheto finish syncing at least the dirty content from the first cache to thesecond cache in operation 1210 before allowing the cache system toservice memory requests from the processor during the speculativeexecution using the second cache in operation 1212.

Optionally, the background syncing circuitry 1102 can continue thesyncing operation while the cache system uses the second cache toservice memory requests from the processor during the speculativeexecution in operation 1212.

In operation 1214, the cache system determines whether the currentexecution type is changed to non-speculative. If the current executiontype remains as speculative, the operations 1210 and 1212 can berepeated.

In response to the determination that the current execution type ischanged to non-speculative at operation 1214, the cache systemdetermines whether the result of the speculative execution is to beaccepted. The result of the speculative execution corresponds to thechanges in the cached content in the second cache. For example, theprocessor 401 can provide an indication of whether the result of thespeculative execution should be accepted via speculation-status signalline 404 illustrated in FIG. 4 or speculation-status signal line 1004 inFIG. 10.

If, in operation 1216, the cache system determines that the result ofthe speculative execution is to be rejected, the cache system candiscard the cached content currently cached in the second cache inoperation 1222 (e.g., discard via setting the invalid bits of cacheblocks in the second cache). Subsequently, in operation 1244, the cachesystem can keep the first cache as main cache and the second cache asshadow cache; and in operation 1208, the background syncing circuitry1102 can copy the cached content from the first cache to the secondcache. When the execution remains non-speculative, operations 1204 to1208 can be repeated.

If, in operation 1216, the cache system determines that the result ofthe speculative execution is to be accepted, the background syncingcircuitry 1102 is configured to further copying content cached in thefirst cache to the second cache to complete syncing at least the dirtycontent from the first cache to the second cache in operation 1218before allowing the cache system to re-configure first cache as shadowcache. In operation 1220, the cache system configures the first cache asshadow cache and the second cache as main cache, in a way somewhatsimilar to the operation 1202. In configuring the first cache as shadowcache, the cache system can invalidate its content and then synchronizethe cached content in the second cache to the first cache, in a waysomewhat similar to the operations 1222, 1224, 1208, and 1204.

For example, when dedicated caches with fixed hardware structures areused as the first cache and the second cache, a configurable bit can bechanged to configure the first cache as shadow cache and the secondcache as main cache in operation 1220. Alternatively, when cache setscan be allocated from a pool of cache sets using registers to from thefirst cache and the second cache, in a way as illustrated in FIGS. 6 to10, the cache sets that are initially in the first cache but are notimpacted by the speculative execution can be reconfigured via theirassociated registers (e.g., registers 612 a and 612 b illustrated inFIGS. 6 and 10) to join the second cache. The cache sets that areinitially in the first cache (but now has out of data content in view ofthe content in the second cache) can be reconfigured as in the new firstcache. Optionally, further cache sets can be allocated from theavailable pool of cache sets and added to the new first cache.Optionally, some of the cache sets that have invalidated cache contentcan be put back into the available pool of cache sets for futureallocation (e.g., for adding to the second cache as the main cache orthe first cache as the shadow cache).

In this specification, the disclosure has been described with referenceto specific exemplary embodiments thereof. However, it will be evidentthat various modifications can be made thereto without departing fromthe broader spirit and scope as set forth in the following claims. Thespecification and drawings are, accordingly, to be regarded in anillustrative sense rather than a restrictive sense.

For example, embodiments can include a cache system, including: a firstcache; a second cache; a connection to a command bus coupled between thecache system and a processor; a connection to an address bus coupledbetween the cache system and the processor; a connection to a data buscoupled between the cache system and the processor; a connection to anexecution-type signal line from the processor identifying an executiontype; and a logic circuit coupled to control the first cache and thesecond cache according to the execution type. In such embodiments, thecache system is configured to be coupled between the processor and amemory system. Also, when the execution type is a first type indicatingnon-speculative execution of instructions by the processor and the firstcache is configured to service commands from the command bus foraccessing the memory system, the logic circuit is configured to copy aportion of content cached in the first cache to the second cache.

In such embodiments, the logic circuit can be configured to copy theportion of content cached in the first cache to the second cacheindependent of a current command received in the command bus.

Also, when the execution type is the first type indicatingnon-speculative execution of instructions by the processor and the firstcache is configured to service commands from the command bus foraccessing the memory system, the logic circuit can be configured toservice subsequent commands from the command bus using the second cachein response to the execution type being changed from the first type to asecond type indicating speculative execution of instructions by theprocessor. The logic circuit can also be configured to completesynchronization of the portion of the content from the first cache tothe second cache before servicing the subsequent commands after theexecution type is changed from the first type to the second type. Thelogic circuit can also be configured to continue synchronization of theportion of the content from the first cache to the second cache whileservicing the subsequent commands.

In such embodiments, the cache system can further include: aconfigurable data bit, and the logic circuit is further coupled tocontrol the first cache and the second cache according to theconfigurable data bit. When the configurable data bit is in a firststate, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system via thefirst cache, when the execution type is the first type; and implementcommands received from the command bus for accessing the memory systemvia the second cache, when the execution type is a second type. And,when the configurable data bit is in a second state, the logic circuitcan be configured to: implement commands received from the command busfor accessing the memory system via the second cache, when the executiontype is the first type; and implement commands received from the commandbus for accessing the memory system via the first cache, when theexecution type is the second type. When the execution type changes fromthe second type to the first type, the logic circuit can also beconfigured to toggle the configurable data bit.

In such embodiments, the cache system can further include: a connectionto a speculation-status signal line from the processor identifying astatus of a speculative execution of instructions by the processor. Theconnection to the speculation-status signal line is configured toreceive the status of a speculative execution. The status of aspeculative execution indicates that a result of a speculative executionis to be accepted or rejected. When the execution type changes from thesecond type to the first type, the logic circuit can be configured to:toggle the configurable data bit, if the status of speculative executionindicates that a result of speculative execution is to be accepted; andmaintain the configurable data bit without changes, if the status ofspeculative execution indicates that a result of speculative executionis to be rejected.

Also, in such embodiments, the first cache and the second cache togetherinclude: a plurality of cache sets, including a first cache set and asecond cache set; and a plurality of registers associated with theplurality of cache sets respectively, including a first registerassociated with the first cache set and a second register associatedwith the second cache set. In such examples, the logic circuit can befurther coupled to control the plurality of cache sets according to theplurality of registers. Also, when the connection to the address busreceives a memory address from the processor, the logic circuit can beconfigured to: generate a set index from at least the memory address;and determine whether the generated set index matches with contentstored in the first register or with content stored in the secondregister. The logic circuit can also be configured to implement acommand received in the connection to the command bus via the firstcache set in response to the generated set index matching with thecontent stored in the first register and via the second cache set inresponse to the generated set index matching with the content stored inthe second register. Furthermore, in response to a determination that adata set of the memory system associated with the memory address is notcurrently cached in the cache system, the logic circuit can beconfigured to allocate the first cache set for caching the data set andstore the generated set index in the first register.

Additionally, in such embodiments having cache sets, the cache systemcan also include a connection to an execution-type signal line from theprocessor identifying an execution type, and the generated set index isgenerated further based on a type identified by the execution-typesignal line. The generated set index can include a predetermined segmentof bits in the memory address and a bit representing the type identifiedby the execution-type signal line. Also, when the first and secondregisters are in a first state, the logic circuit can be configured to:implement commands received from the command bus for accessing thememory system via the first cache set, when the execution type is afirst type; and implement commands received from the command bus foraccessing the memory system via the second cache set, when the executiontype is a second type. And, when the first and second registers are in asecond state, the logic circuit is configured to: implement commandsreceived from the command bus for accessing the memory system viaanother cache set of the plurality of cache sets besides the first cacheset, when the execution type is the first type; and implement commandsreceived from the command bus for accessing the memory system viaanother other cache set of the plurality of cache sets besides thesecond cache set, when the execution type is the second type.

In such embodiments having cache sets, each one of the plurality ofregisters can be configured to store a set index. And, when theexecution type changes from the second type to the first type, the logiccircuit can be configured to change the content stored in the firstregister and the content stored in the second register. Also, the firsttype can be configured to indicate non-speculative execution ofinstructions by the processor and the second type can be configured toindicate speculative execution of instructions by the processor. In suchexamples, the cache system can further include a connection to aspeculation-status signal line from the processor identifying a statusof a speculative execution of instructions by the processor. Theconnection to the speculation-status signal line is configured toreceive the status of a speculative execution, and the status of aspeculative execution indicates that a result of a speculative executionis to be accepted or rejected. When the execution type changes from thesecond type to the first type, the logic circuit can be configured to:change the content stored in the first register and the content storedin the second register, if the status of speculative execution indicatesthat a result of speculative execution is to be accepted; and maintainthe content stored in the first register and the content stored in thesecond register without changes, if the status of speculative executionindicates that a result of speculative execution is to be rejected.

Also, for example, embodiments can include a cache system, including: ingeneral, a plurality of cache sets and a plurality of registersassociated with the plurality of cache sets respectively. The pluralityof cache sets includes a first cache set and a second cache set, and theplurality of registers includes a first register associated with thefirst cache set and a second register associated with the second cacheset. Similarly, in such embodiments, the cache system can include aconnection to a command bus coupled between the cache system and aprocessor, a connection to an address bus coupled between the cachesystem and the processor, a connection to a data bus coupled between thecache system and the processor, a connection to an execution-type signalline from the processor identifying an execution type, and a logiccircuit coupled to control the plurality of cache sets according to theexecution type. The cache system can also be configured to be coupledbetween the processor and a memory system. And, when the execution typeis a first type indicating non-speculative execution of instructions bythe processor and the first cache set is configured to service commandsfrom the command bus for accessing the memory system, the logic circuitcan be configured to copy a portion of content cached in the first cacheset to the second cache set.

In such embodiments with cache sets, the logic circuit can be configuredto copy the portion of content cached in the first cache set to thesecond cache set independent of a current command received in thecommand bus. When the execution type is the first type indicatingnon-speculative execution of instructions by the processor and the firstcache set is configured to service commands from the command bus foraccessing the memory system, the logic circuit can be configured toservice subsequent commands from the command bus using the second cacheset in response to the execution type being changed from the first typeto a second type indicating speculative execution of instructions by theprocessor. The logic circuit can also be configured to completesynchronization of the portion of the content from the first cache setto the second cache set before servicing the subsequent commands afterthe execution type is changed from the first type to the second type.The logic circuit can also be configured to continue synchronization ofthe portion of the content from the first cache set to the second cacheset while servicing the subsequent commands.

Also, in such embodiments with cache sets, the logic circuit can befurther coupled to control the plurality of cache sets according to theplurality of registers. When the connection to the address bus receivesa memory address from the processor, the logic circuit can be configuredto: generate a set index from at least the memory address; and determinewhether the generated set index matches with content stored in the firstregister or with content stored in the second register. The logiccircuit can also be configured to implement a command received in theconnection to the command bus via the first cache set in response to thegenerated set index matching with the content stored in the firstregister and via the second cache set in response to the generated setindex matching with the content stored in the second register. Also, inresponse to a determination that a data set of the memory systemassociated with the memory address is not currently cached in the cachesystem, the logic circuit can be configured to allocate the first cacheset for caching the data set and store the generated set index in thefirst register.

Additionally, in such embodiments with cache sets, the cache system canfurther include a connection to an execution-type signal line from theprocessor identifying an execution type, and the generated set index canbe generated further based on a type identified by the execution-typesignal line. The generated set index can include a predetermined segmentof bits in the memory address and a bit representing the type identifiedby the execution-type signal line. When the first and second registersare in a first state, the logic circuit can be configured to: implementcommands received from the command bus for accessing the memory systemvia the first cache set, when the execution type is a first type; andimplement commands received from the command bus for accessing thememory system via the second cache set, when the execution type is asecond type. And, when the first and second registers are in a secondstate, the logic circuit can be configured to: implement commandsreceived from the command bus for accessing the memory system viaanother cache set of the plurality of cache sets besides the first cacheset, when the execution type is the first type; and implement commandsreceived from the command bus for accessing the memory system viaanother other cache set of the plurality of cache sets besides thesecond cache set, when the execution type is the second type.

In such embodiments with cache sets, each one of the plurality ofregisters is configured to store a set index, and when the executiontype changes from the second type to the first type, the logic circuitcan be configured to change the content stored in the first register andthe content stored in the second register. Also, the first type can beconfigured to indicate non-speculative execution of instructions by theprocessor and the second type is configured to indicate speculativeexecution of instructions by the processor.

In such embodiments with cache sets, the cache system can also include aconnection to a speculation-status signal line from the processoridentifying a status of a speculative execution of instructions by theprocessor. The connection to the speculation-status signal line isconfigured to receive the status of a speculative execution, and thestatus of a speculative execution indicates that a result of aspeculative execution is to be accepted or rejected. When the executiontype changes from the second type to the first type, the logic circuitcan be configured to: change the content stored in the first registerand the content stored in the second register, if the status ofspeculative execution indicates that a result of speculative executionis to be accepted; and maintain the content stored in the first registerand the content stored in the second register without changes, if thestatus of speculative execution indicates that a result of speculativeexecution is to be rejected.

Also, in such embodiments with cache sets, the cache sets can be dividedamongst a plurality of caches within the cache system. For instance, thecache sets can be divided up amongst first and second caches of theplurality of caches.

FIGS. 13, 14A, 14B, 14C, 15A, 15B, 15C, and 15D show example aspects ofan example computing device having a cache system (e.g., see cachesystem 1000 shown in FIG. 13) having interchangeable cache sets (e.g.,see cache sets 1310 a, 1310 b, 1310 c, and 1310 d) including a sparecache set (e.g., see spare cache set 1310 d shown in FIGS. 14A and 15A)to accelerate speculative execution, in accordance with some embodimentsof the present disclosure.

In addition to using a shadow cache for securing speculative executions,as well as synchronizing content between a main cache and the shadowcache to save the content cached in the main cache in preparation ofacceptance of the content in the shadow cache, a spare cache set can beused to accelerate the speculative executions (e.g., see the spare cacheset 1310 d as depicted in FIGS. 14A and 15A as well as cache set 1310 bas depicted in FIGS. 15B and 15C and cache set 1310 c as depicted inFIG. 15D). A spare cache set can also be used to accelerate thespeculative executions without use of a shadow cache. Data held in cachesets used as a shadow cache can be validated and therefore used fornormal execution (e.g., see the cache set 1310 c as depicted in FIGS.14A and 15A as well as cache set 1310 d as depicted in FIGS. 15B and 15Cand cache set 1310 b as depicted in FIG. 15D each of which can be usedfor a speculative execution and be a cache set of a shadow cache, andthen after content validation can be used for normal execution). And,some cache sets used as the main cache for normal or non-speculativeexecution (e.g., see the cache set 1310 b as depicted in FIGS. 14A and15A as well as cache set 1310 c as depicted in FIGS. 15B and 15C andcache set 1310 d as depicted in FIG. 15D) may not be ready to be used asthe shadow cache for speculative execution. Thus, one or more cache setscan be used as spare cache sets to avoid delays from waiting for cacheset availability (e.g., see the spare cache set 1310 d as depicted inFIGS. 14A and 15A as well as cache set 1310 b as depicted in FIGS. 15Band 15C and cache set 1310 c as depicted in FIG. 15D).

Once a speculation is confirmed, the content of the cache sets used as ashadow cache is confirmed to be valid and up-to-date; and thus, theformer cache sets used as the shadow cache for speculative execution areused for normal execution. For example, see the cache set 1310 c asdepicted in FIGS. 14A and 15A as well as cache set 1310 d as depicted inFIGS. 15B and 15C and cache set 1310 b as depicted in FIG. 15D, each ofwhich can be used for a speculative execution and be a cache set of ashadow cache, and then after content validation can be used for normalexecution. However, some of the cache sets initially used as the normalcache may not be ready to be used for a subsequent speculativeexecution. For instance, see the cache set 1310 b as depicted in FIGS.14A and 15A as well as cache set 1310 c as depicted in FIGS. 15B and 15Cand cache set 1310 d as depicted in FIG. 15D, each of which is used aspart of a normal cache but may not be ready to be used for a subsequentspeculative execution. Therefore, one or more cache sets can be used asspare cache sets to avoid delays from waiting for cache set availabilityand accelerate the speculative executions. For example, see the sparecache set 1310 d as depicted in FIGS. 14A and 15A as well as cache set1310 b as depicted in FIGS. 15B and 15C and cache set 1310 c as depictedin FIG. 15D, each of which are being used as a spare cache set.

In some embodiments, where the cache system has background syncingcircuitry (e.g., see background synching circuitry 1102), if the syncingfrom a cache set in the normal cache to a corresponding cache set in theshadow cache has not yet been completed (e.g., see syncing 1130 shown inFIG. 11A), the cache set in the normal cache cannot be freed immediatelyfor use in the next speculative execution. In such a situation, if thereis no spare cache set, the next speculative execution has to wait untilthe syncing is complete so that the corresponding cache set in thenormal cache can be freed. This is just one example, of when a sparecache set is beneficial. There are many other situations when cache setsin the normal cache cannot be freed immediately.

Also, for example, the speculative execution may reference a memoryregion in the memory system (e.g., see memory system 603 in FIGS. 6, 10,and 13) that has no overlapping with the memory region cached in thecache sets used in the normal cache. As a result of accepting the resultof the speculative execution, the cache sets in the shadow cache and thenormal cache are now all in the normal cache. This can cause delays aswell, because it takes time for the cache system to free a cache set tosupport the next speculative execution. To free one, the cache systemneeds to identify a cache set, such as a least used cache set, andsynchronize the cache set with the memory system. If the cache has datathat is more up to date than the memory system, the data needs to bewritten into the memory system.

Additionally, a system using a spare cache set (e.g., see the sparecache set 1310 d as depicted in FIGS. 14A and 15A as well as cache set1310 b as depicted in FIGS. 15B and 15C and cache set 1310 c in FIG.15D) can also use background synchronizing circuitry (such as thebackground synchronizing circuitry 1102). When an initial speculation isconfirmed, the cache set used in the initial speculation (e.g., see thecache set 1310 c as depicted in FIGS. 14A and 15A) can be switched tojoin the set of cache sets used for a main execution (e.g., see thecache set 1310 a as shown in FIGS. 14A, B, and C and as depicted inFIGS. 15A, B, C, and D, which is a cache set of a set of cache sets usedfor main or non-speculative execution). Instead of using a cache setfrom the prior main execution that was being used for the case of thespeculation failing (e.g., see the cache set 1310 b as depicted in FIGS.14A and 15A as well as cache set 1310 c as depicted in FIGS. 15B and 15Cand cache set 1310 d in FIG. 15D), a spare cache set can be madeavailable immediately for a next speculative execution (e.g., see thespare cache set 1310 d as depicted in FIGS. 14A and 15A as well as cacheset 1310 b as depicted in FIGS. 15B and 15C and cache set 1310 c in FIG.15D). The spare cache set can be updated for the next speculativeexecution via the background synchronizing circuitry 1102 for example.And, because of background synchronizing, a spare cache set, such as thespare cache set 1310 d as shown in FIGS. 14A and 15A, is ready for usewhen the cache set currently used for the speculation execution, such asthe cache set 1310 c as shown in FIGS. 14A and 15A, is ready to beaccepted for normal execution. This way there is no delay in waiting foruse of the next cache set for the next speculative execution. To preparefor the next speculative execution, the spare cache set, such as thecache set 1310 c as shown in FIGS. 14A and 15A, can be synchronized to anormal cache set, such as the cache set 1310 b as shown in FIGS. 14A and15A, that is likely to be used in the next speculative execution or aleast used cache set in the system.

FIG. 13 shows example aspects of an example computing device having acache system 1000 having interchangeable cache sets (e.g., see cachesets 1310 a, 1310 b, 1310 c, and 1310 d) including a spare cache set toaccelerate speculative execution, in accordance with some embodiments ofthe present disclosure. The computing device, in FIG. 13, is similar tothe computing device depicted in FIG. 10. For example, the device shownin FIG. 13 includes processor 1001, memory system 603, cache system1000, and connections 604 a to 604 d and 609 a to 609 c as well asconnection 1002.

In FIG. 13, the cache system 1000 is shown having cache sets (e.g.,cache sets 1310 a, 1310 b, 1310 c, and 1310 d). The cache system 1000 isalso shown having connection 604 d to execution-type signal line 605 dfrom processor 1001 identifying an execution type and connection 1002 toa signal line 1004 from the processor 1001 identifying a status ofspeculative execution.

The cache system 1000 is also shown including logic circuit 1006 thatcan be configured to allocate a first subset of the cache sets (e.g.,see cache 602 a as shown in FIG. 13) for caching in caching operationswhen the execution type is a first type indicating non-speculativeexecution of instructions by the processor 1001. The logic circuit 1006can also be configured to allocate a second subset of the cache sets(e.g., see cache 602 b as shown in FIG. 13) for caching in cachingoperations when the execution type changes from the first type to asecond type indicating speculative execution of instructions by theprocessor. The logic circuit 1006 can also be configured to reserve atleast one cache set or a third subset of cache sets (e.g., see cache 602c as shown in FIG. 13) when the execution type is the second type.

The logic circuit 1006 can also be configured to reconfigure the secondsubset for caching in caching operations (e.g., see cache 602 b as shownin FIG. 13), when the execution type is the first type and when theexecution type changes from the second type to the first type and thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted. And, the logic circuit 1006 can also beconfigured to allocate the at least one cache set or third subset forcaching in caching operations (e.g., see cache 602 c as shown in FIG.13), when the execution type changes from the first type to the secondtype and when the execution type changes from the second type to thefirst type and the status of speculative execution indicates that aresult of speculative execution is to be accepted. The logic circuit1006 can also be configured to configured to reserve the at least onecache set or the third subset (e.g., see cache 602 c as shown in FIG.13), when the execution type is the second type and when the at leastone cache set is a least used cache set in the plurality of cache sets.

In some embodiments, a cache system can include one or more mappingtables that can map the cache sets mentioned herein. And, in suchembodiments, a logic circuit, such as the logic circuits mentionedherein, can be configured to allocate and reconfigure subsets of cachesets, such as caches in a cache system, according to the one or moremapping tables. The map can be an alternative to the cache set registersdescribed herein or used in addition to such registers.

In some embodiments, as shown in at least FIGS. 13, 14A to 14C, and 15Ato 15D, the cache system 1000 can include cache set registers (e.g., seecache set registers 1312 a, 1312 b, 1312 c, and 1312 d) associated withthe cache sets (e.g., see cache sets 1310 a, 1310 b, 1310 c, and 1310d), respectively. In such embodiments, the logic circuit 1006 can beconfigured to allocate and reconfigure subsets of the of cache sets(e.g., see caches 602 a, 602 b, and 602 c as shown in FIG. 13) accordingto the cache set registers.

Also, in some embodiments, as shown in FIGS. 15A to 15D, a first subsetof the cache sets can include a first cache set, a second subset of thecache sets can include a second cache set, and a third subset caninclude a third cache set. In such embodiments, the cache set registerscan include a first cache set register associated with the first cacheset which is configured to store a first cache set index initially sothat the first cache set is used for non-speculative execution (e.g.,see cache set index 1504 b held in cache set register 1312 b as shown inFIG. 15A). The cache set registers can also include a second cache setregister associated with the second cache set which is configured tostore a second cache set index initially so that the second cache set isused for speculative execution (e.g., see cache set index 1504 c held incache set register 1312 c as shown in FIG. 15A). The cache set registerscan also include a third cache set register associated with the thirdcache set which is configured to store a third cache set index initiallyso that the third cache set is used as a spare cache set (e.g., seecache set index 1504 d held in cache set register 1312 d as shown inFIG. 15A).

Also, in such embodiments, the logic circuit 1006 can be configured togenerate a set index (e.g., see set indexes 1504 a, 1504 b, 1504 c, and1504 d) based on a memory address received from address bus 605 b, fromprocessor 1001 and an identification of speculative execution ornon-speculative execution received from execution-type signal line 605 dfrom the processor identifying execution type. And, the logic circuit1006 can be configured to determine whether the set index matches withcontent stored in the first cache set register, the second cache setregister, or the third cache set register.

Also, in such embodiments, the logic circuit 1006 can be configured tostore the first cache set index in the second cache set register oranother cache set register associated with another cache set in thesecond subset of the plurality of cache sets, so that the second cacheset or the other cache set in the second subset is used fornon-speculative execution, when the execution type changes from thesecond type to the first type and the status of speculative executionindicates that a result of speculative execution is to be accepted. Forexample, see FIG. 15B depicting cache set index 1504 b held in thesecond cache set register 1312 c, so that the second cache set 1310 ccan be used for non-speculative execution. Further, the logic circuit1006 can be configured to store the second cache set index in the thirdcache set register or another cache set register associated with anothercache set in the at least one cache set, so that the third cache set orthe other cache set in the at least one cache set is used forspeculative execution, when the execution type changes from the secondtype to the first type and the status of speculative execution indicatesthat a result of speculative execution is to be accepted. For example,see FIG. 15B depicting cache set index 1504 c held in the third cacheset register 1312 d, so that the third cache set 1310 d is available andcan be used for speculative execution. The logic circuit 1006 can alsobe configured to store the third cache set index in the first cache setregister or another cache set register associated with another cache setin the first subset of the plurality of cache sets, so that the firstcache set or the other cache set in the first subset is used as a sparecache set, when the execution type changes from the second type to thefirst type and the status of speculative execution indicates that aresult of speculative execution is to be accepted. For example, see FIG.15B depicting cache set index 1504 d held in the first cache setregister 1312 b, so that the first cache set 1310 b is used as a sparecache set.

FIGS. 14A, 14B, and 14C show example aspects of the example computingdevice having the cache system 1000 having interchangeable cache sets(e.g., see cache sets 1310 a, 1310 b, 1310 c, and 1310 d) including aspare cache set (e.g., see spare cache set 1310 d as shown in FIGS. 14Aand 14B and spare cache set 1310 b as shown in FIG. 14C) to acceleratespeculative execution, in accordance with some embodiments of thepresent disclosure. Specifically, FIG. 14A shows the cache sets in afirst state where cache sets 1310 a and 1310 b can be used fornon-speculative executions, cache set 1310 c can be used for aspeculative execution, and cache set 1310 d is used as a spare cacheset. FIG. 14B shows the cache sets in a second state where cache sets1310 a, 1310 b, and 1310 c can be used for non-speculative executionsand cache set 1310 c is available for and can be used for a speculativeexecution. FIG. 14C, shows the cache sets in a third state where cachesets 1310 a, and 1310 c can be used for non-speculative executions,cache set 1310 d can be used for speculative executions, and cache set1310 b is used as a spare cache set.

FIGS. 15A, 15B, 15C and 15D each show example aspects of the examplecomputing device having the cache system 1000 having interchangeablecache sets (e.g., see cache sets 1310 a, 1310 b, 1310 c, and 1310 d)including a spare cache set to accelerate speculative execution, inaccordance with some embodiments of the present disclosure.

Specifically, FIG. 15A shows the cache sets in a first state where cachesets 1310 a and 1310 b can be used for non-speculative executions (orfirst type of executions), cache set 1310 c can be used for aspeculative execution (or a second type execution), and cache set 1310 dis used as a spare cache set. As shown in FIG. 15A, in this first state,the logic circuit 1006 can be configured to store the cache set index1504 b in the cache set register 1312 b so that content 1502 b in thecache set 1310 b is used for non-speculative execution. Further, in thisfirst state, the logic circuit 1006 can be configured to store the cacheset index 1504 c in the cache set register 1312 c so that the cache set1310 c is available and can be used for speculative execution. The logiccircuit 1006 can also be configured to store the cache set index 1504 din the cache set register 1312 d so that the cache set 1310 d is used asa spare cache set in this first state.

FIG. 15B shows the cache sets in a second state where cache sets 1310 aand 1310 c can be used for non-speculative executions, cache set 1310 dis available for a speculative execution, and cache set 1310 b is usedas a spare cache set. The second state depicted in FIG. 15B occurs whenthe execution type changes from the second type to the first type andthe status of speculative execution indicates that a result ofspeculative execution is to be accepted. As shown in FIG. 15B, in thissecond state, the logic circuit 1006 can be configured to store thecache set index 1504 b in the cache set register 1312 c so that content1502 b in the cache set 1310 c is used for non-speculative execution.Further, in this second state, the logic circuit 1006 can be configuredto store the cache set index 1504 c in the cache set register 1312 d sothat the cache set 1310 d is available for speculative execution. Thelogic circuit 1006 can also be configured to store the cache set index1504 d in the cache set register 1312 b so that the cache set 1310 b isused as a spare cache set in this second state.

FIG. 15C shows the cache sets in the second state for the most part,where cache sets 1310 a and 1310 c can be used for non-speculativeexecutions and cache set 1310 b is used as a spare cache set. But, inFIG. 15C, it is shown that cache set 1310 d is being used for aspeculative execution instead of being merely available. As shown inFIG. 15C, in this second state, the logic circuit 1006 can be configuredto store the cache set index 1504 c in the cache set register 1312 d sothat the content 1502 c held in the cache set 1310 d can also be usedfor speculative execution.

FIG. 15D shows the cache sets in a third state where cache sets 1310 aand 1310 d can be used for non-speculative executions, cache set 1310 bis available for a speculative execution, and cache set 1310 c is usedas a spare cache set. The third state depicted in FIG. 15D occurs, in asubsequent cycle after the second state, when the execution type changesagain from the second type to the first type and the status ofspeculative execution indicates that a result of speculative executionis to be accepted. As shown in FIG. 15D, in this third state, the logiccircuit 1006 can be configured to store the cache set index 1504 b inthe cache set register 1312 d so that content 1502 b in the cache set1310 d is used for non-speculative execution. Further, in this thirdstate, the logic circuit 1006 can be configured to store the cache setindex 1504 c in the cache set register 1312 b so that the cache set 1310b is available for speculative execution. The logic circuit 1006 canalso be configured to store the cache set index 1504 d in the cache setregister 1312 c so that the cache set 1310 c is used as a spare cacheset in this third state.

As shown by FIGS. 15A to 15D, the cache sets are interchangeable and thecache set used as the spare cache set is interchangeable as well.

In such embodiments, when the connection 604 b to the address bus 605 breceives a memory address from the processor 1001, the logic circuit1006 can be configured to generate a set index from at least the memoryaddress 102 b according to this cache set index 112 b of the address(e.g., see set index generations 1506 a, 1506 b, 1506 c, and 1506 d,which generate set indexes 1504 a, 1504 b, 1504 c, and 1504 drespectively). Also, when the connection 604 b to the address bus 605 breceives a memory address from the processor 1001, the logic circuit1006 can be configured to determine whether the generated set indexmatches with content stored in one of the registers (which can be storedset index 1504 a, 1504 b, 1504 c, or 1504 d). Also, the logic circuit1006 can be configured to implement a command received in the connection604 a to the command bus 605 a via a cache set in response to thegenerated set index matching with the content stored in thecorresponding register. Also, in response to a determination that a dataset of the memory system associated with the memory address is notcurrently cached in the cache system, the logic circuit 1001 can beconfigured to allocate the cache set for caching the data set and storethe generated set index in the corresponding register. The generated setindex can include a predetermined segment of bits in the memory addressas shown in FIGS. 15A to 15B.

Also, in such embodiments, the logic circuit 1006 can be configured togenerate a set index (e.g., see set indexes 1504 a, 1504 b, 1504 c, and1504 d) based on a memory address (e.g., memory address 102 b) receivedfrom address bus 605 b, from processor 1001 and an identification ofspeculative execution or non-speculative execution received fromexecution-type signal line 605 d from the processor identifyingexecution type. And, the logic circuit 1006 can be configured todetermine whether the set index matches with content stored in the cacheset register 1312 b, the cache set register 1312 c, or the cache setregister 1312 d.

In some embodiments, a cache system can include a plurality of cachesets, a connection to an execution-type signal line from a processoridentifying an execution type, a connection to a signal line from theprocessor identifying a status of speculative execution, and a logiccircuit. The logic circuit can be configured to: allocate a first subsetof the plurality of cache sets for caching in caching operations whenthe execution type is a first type indicating non-speculative executionof instructions by the processor, and allocate a second subset of theplurality of cache sets for caching in caching operations when theexecution type changes from the first type to a second type indicatingspeculative execution of instructions by the processor. The logiccircuit can also be configured to reserve at least one cache set (or athird subset of the plurality of cache sets) when the execution type isthe second type. The logic circuit can also be configured to reconfigurethe second subset for caching in caching operations when the executiontype is the first type, when the execution type changes from the secondtype to the first type and the status of speculative execution indicatesthat a result of speculative execution is to be accepted. And, the logiccircuit can also be configured to allocate the at least one cache set(or the third subset of the plurality of cache sets) for caching incaching operations when the execution type changes from the first typeto the second type, when the execution type changes from the second typeto the first type and the status of speculative execution indicates thata result of speculative execution is to be accepted.

In such embodiments, the logic circuit can be configured to reserve theat least one cache set (or the third subset of the plurality of cachesets) when the execution type is the second type and the at least onecache set (or the third subset of the plurality of cache sets) includesa least used cache set in the plurality of cache sets.

Also, in such embodiments, the cache system can include one or moremapping tables mapping the plurality of cache sets. In such an example,the logic circuit is configured to allocate and reconfigure subsets ofthe plurality of cache sets according to the one or more mapping tables.

Also, in such embodiments, the cache system can include a plurality ofcache set registers associated with the plurality of cache sets,respectively. In such an example, the logic circuit is configured toallocate and reconfigure subsets of the plurality of cache setsaccording to the plurality of cache set registers. In such an example,the first subset of the plurality of cache sets can include a firstcache set, the second subset of the plurality of cache sets can includea second cache set, and the at least one cache set (or the third subsetof the plurality of cache sets) can include a third cache set. Also, theplurality of cache set registers can include a first cache set registerassociated with the first cache set, configured to store a first cacheset index initially so that the first cache set is used fornon-speculative execution. The plurality of cache set registers can alsoinclude a second cache set register associated with the second cacheset, configured to store a second cache set index initially so that thesecond cache set is used for speculative execution. The plurality ofcache set registers can also include a third cache set registerassociated with the third cache set, configured to store a third cacheset index initially so that the third cache set is used as a spare cacheset.

In such embodiments, the logic circuit can be configured to generate aset index based on a memory address received from an address bus from aprocessor and identification of speculative execution or non-speculativeexecution received from an execution-type signal line from the processoridentifying execution type. And, the logic circuit can be configured todetermine whether the set index matches with content stored in the firstcache set register, the second cache set register, or the third cacheset register. When the execution type changes from the second type tothe first type and the status of speculative execution indicates that aresult of speculative execution is to be accepted, the logic circuit canalso be configured to store the first cache set index in the secondcache set register or another cache set register associated with anothercache set in the second subset of the plurality of cache sets, so thatthe second cache set or the other cache set in the second subset is usedfor non-speculative execution. When the execution type changes from thesecond type to the first type and the status of speculative executionindicates that a result of speculative execution is to be accepted, thelogic circuit can also be configured to store the second cache set indexin the third cache set register or another cache set register associatedwith another cache set in the at least one cache set (or the thirdsubset of the plurality of cache sets), so that the third cache set orthe other cache set in the at least one cache set (or the third subsetof the plurality of cache sets) is used for speculative execution. Whenthe execution type changes from the second type to the first type andthe status of speculative execution indicates that a result ofspeculative execution is to be accepted, the logic circuit can also beconfigured to store the third cache set index in the first cache setregister or another cache set register associated with another cache setin the first subset of the plurality of cache sets, so that the firstcache set or the other cache set in the first subset is used as a sparecache set.

In some embodiments, a cache system can include a plurality of cachesets having a first subset of cache sets, a second subset of cache sets,and a third subset of cache sets. The cache system can also include aconnection to an execution-type signal line from a processor identifyingan execution type, a connection to a signal line from the processoridentifying a status of speculative execution, and a logic circuit. Thelogic circuit can be configured to allocate the first subset of theplurality of cache sets for caching in caching operations when theexecution type is a first type indicating non-speculative execution ofinstructions by the processor and allocate the second subset of theplurality of cache sets for caching in caching operations when theexecution type changes from the first type to a second type indicatingspeculative execution of instructions by the processor. The logiccircuit can also be configured to reserve the third subset of theplurality of cache sets when the execution type is the second type. Thelogic circuit can also be configured to reconfigure the second subsetfor caching in caching operations when the execution type is the firsttype, when the execution type changes from the second type to the firsttype and the status of speculative execution indicates that a result ofspeculative execution is to be accepted. The logic circuit can also beconfigured to allocate the third subset for caching in cachingoperations when the execution type changes from the first type to thesecond type, when the execution type changes from the second type to thefirst type and the status of speculative execution indicates that aresult of speculative execution is to be accepted.

In some embodiments, a cache system can include a plurality of cachesincluding a first cache, a second cache, and a third cache. The cachesystem can also include a connection to an execution-type signal linefrom a processor identifying an execution type, a connection to a signalline from the processor identifying a status of speculative execution,and a logic circuit. The logic circuit can be configured to allocate thefirst cache for caching in caching operations when the execution type isa first type indicating non-speculative execution of instructions by theprocessor and allocate the second cache for caching in cachingoperations when the execution type changes from the first type to asecond type indicating speculative execution of instructions by theprocessor. The logic circuit can also be configured to reserve the thirdcache when the execution type is the second type. The logic circuit canalso be configured to reconfigure the second cache for caching incaching operations when the execution type is the first type, when theexecution type changes from the second type to the first type and thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted. And, the logic circuit can also beconfigured to allocate the third cache for caching in caching operationswhen the execution type changes from the first type to the second type.

FIGS. 16 and 17 show example aspects of example computing devices havingcache systems having interchangeable cache sets (e.g., see cache sets1610 a, 1610 b, 1710 a, and 1710 b) utilizing extended tags (e.g., seeextended tags 1640 a, 1640 b, 1740 a, and 1740 b) for different types ofexecutions by a processor (such as speculative and non-speculativeexecutions), in accordance with some embodiments of the presentdisclosure. Also, FIGS. 16 and 17 illustrate different ways to addresscache sets and cache blocks within a cache system—such as cache systems600 and 1000 depicted in FIGS. 6, 10, and 13 respectively. Also, shownare ways cache sets and cache blocks can be selected via a memoryaddress, such as memory address 102 e or 102 b as well as memory address102 a, 102 c, or 102 d (shown in FIG. 1).

Both examples in FIGS. 16 and 17 use set associativity, and canimplement cache systems using set associativity—such as cache systems600 and 1000. In FIG. 16, set associativity is implicitly defined (e.g.,defined through an algorithm that can be used to determine which tagshould be in which cache set for a given execution type). In FIG. 17,set associativity is implemented via the bits of cache set index in thememory address. Also, the functionality illustrated in FIGS. 16 and 17can be implemented without use of set associativity (although this isnot depicted), such as implement through cache systems 200 and 400 shownin FIGS. 2 and 4 respectively.

In FIGS. 16 and 17, a block index (e.g., see block indexes 106 e and 106b) can be used as an address within individual cache sets (e.g., seecache sets 1610 a, 1610 b, 1710 a, and 1710 b) to identify particularcache blocks (e.g., see cache blocks 1624 a, 1624 b, 1628 a, 1628 b,1724 a, 1724 b, 1728 a, and 1728 b) in a cache set. And, the extendedtags (e.g., extended tags 1640 a, 1640 b, 1740 a, 1740 b, 1650, and1750) can be used as addresses for the cache sets. A block index (e.g.,see block indexes 106 e and 106 b) of a memory address (e.g., see memoryaddress 102 e and 102 b) can be used for each cache set (e.g., see cachesets 1610 a, 1610 b, 1710 a, and 1710 b) to get a cache block (e.g., seecache blocks 1624 a, 1624 b, 1628 a, 1628 b, 1724 a, 1724 b, 1728 a, and1728 b) and a tag associated with the cache block (e.g., seecorresponding tags 1622 a, 1622 b, 1626 a, 1626 b, 1722 a, 1722 b, 1726a, and 1726 b).

Also, as shown in FIGS. 16 and 17, tag compare circuits (e.g., tagcompare circuits 1660 a, 1660 b, 1760 a, and 1760 b) can compare theextended tags generated from the cache sets (e.g., extended tags 1640 a,1640 b, 1740 a, and 1740 b) with the extended cache tag (e.g., extendedtag 1650) from a memory address (e.g., see memory address 102 e and 102b) and a current execution type (e.g., see execution types 110 e and 110b) to determine a cache hit or miss. The construction of the extendedtags guarantee that there is at most one hit among the cache sets (e.g.,see cache sets 1610 a, 1610 b, 1710 a, and 1710 b). If there is a hit, acache block (e.g., see cache blocks 1624 a, 1624 b, 1628 a, 1628 b, 1724a, 1724 b, 1728 a, and 1728 b) from the selected cache set provides theoutput. Otherwise, the data associated with the memory address (e.g.,memory address 102 e or 102 b) is not cached in or outputted from any ofthe cache sets. In short, the extended tags depicted in FIGS. 16 and 17are used to select a cache set, and the block indexes are used to selecta cache block and its tag within a cache set.

Also, as shown in FIGS. 16 and 17, the memory addresses (e.g., seeaddresses 102 e and 102 b) are partitioned in different ways; and thus,control of the cache operations according to the addresses are differentas well. However, there are some similarities. For example, the systemsshown in FIGS. 16 and 17 control cache set use via set associativity.The control of the cache operations can include controlling whether acache set is used for a first or second type of execution by theprocessor (e.g., non-speculative and speculative executions) and suchcontrol can be controlled via set associativity to some extent orcompletely.

In FIG. 16, extended tag 1650 for the memory address 102 e has anexecution type 110 e and tag 104 e having a cache set indicator thatimplements the set associativity. In FIG. 17, extended tag 1750 for thememory address 102 b has an execution type 110 e, cache set index 112 b,and tag 104 b. In such an example, the cache set index 112 b implementsthe set associativity instead of the cache set indicator in the tag. Thedifferent partitioning of the memory address slightly changes how anextended tag (e.g., extended tags 1640 a, 1640 b, 1650, 1740 a, and 1740b and 1750) controls the cache operations via set associativity.

With the memory address partitioning, in the examples, the extended tagfrom the memory address and the execution type (e.g., see extended tags1650 and 1750) are compared with an extended tag for a cache set (e.g.,see extended tags 1640 a, 1640 b, 1740 a, and 1740 b) for controllingcache operations implemented via the cache set. The tag compare circuits(e.g., tag compare circuits 1660 a, 1660 b, 1760 a, and 1760 b) canoutput a hit or miss depending on if the extended tags inputted into thecompare circuits match or not. The extended tags for the cache sets(e.g., see extended tags 1640 a, 1640 b, 1740 a, and 1740 b) can bederived from an execution type (e.g., see the execution types 1632 a,1632 b), 1732 a, and 1732 b) held in a register (e.g., see registers1612 a, 1612 b, 1712 a, and 1712 b) and a block tag (e.g., see tags 1622a, 1622 b, 1626 a, 1626 b, 1722 a, 1722 b, 1726 a, and 1726 b) from afirst cache set (e.g., see cache sets 1610 a, 1610 b, 1710 a, and 1710b). And, as shown in FIGS. 16 and 17, the execution types are differentin each register of the cache sets. For the examples shown, the firstcache set (e.g., cache set 1610 a or 1710 a) can be used for the firsttype of execution (e.g., non-speculative execution) and the second cacheset (e.g., cache set 1610 b or 1710 b) can be used for the second typeof execution (e.g., speculative execution).

In FIG. 17, the combination of tag 104 b and cache set index 112 bprovides similar functionality as tag 104 e shown in FIG. 16. However,in FIG. 17, by separating tag 104 b and cache set index 112 b, a cacheset does not have to store redundant copies of the cache set index 112 bsince a cache set (e.g., see cache sets 1710 a and 1710 b) can beassociated with a cache set register (e.g., see registers 1732 a and1732 b) to hold cache set indexes (e.g., see cache set indexes 1732 aand 1732 b). Whereas, in FIG. 16, a cache set (e.g., see cache sets 1610a and 1610 b) does need to store redundant copies of a cache setindicator in each of its blocks (e.g., see blocks 1624 a, 1624 b, 1628a, and 1628 b) since the cache set's associated register is notconfigured to hold a cache set index.

In other words, since tags 1622 a, 1622 b, etc., have the same cache setindicator, the indicator could be stored once in a register for thecache set (e.g., see cache set registers 1712 a and 1712 b). This is oneof the benefits of the arrangement depicted in FIG. 17 over thearrangement depicted in FIG. 16. Also, the lengths of the tags 1722 a,1722 b, 1726 a, and 1726 b in FIG. 17 are shorter in comparison with theimplementation of the tags shown in FIG. 16 (e.g., see 1622 a, 1622 b,1626 a, and 1626 b), since the cache set registers depicted in FIG. 17(e.g., registers 1710 a and 1710 b) store both the cache set index andthe execution type.

When the execution type is combined with the cache set index to form anextended cache set index, the extended cache set index can be used toselect one of the cache sets. Then, the tag from the selected cache setis compared to the tag in the address to determine hit or miss. Thetwo-stage selection can be similar to a conventional two-stage selectionusing a cache set index or can be used to be combined with the extendedtag to support more efficient interchanging of cache sets for differentexecution types (such as speculative and non-speculative executiontypes).

In some embodiments, a cache system (such as the cache system 600 or1000) can include a plurality of cache sets (such as cache sets 610 a to610 c, 1010 a to 1010 c, 1310 a to 1310 d, 1610 a to 1610 b, or 1710 ato 1710 b). The plurality of cache sets can include a first cache setand a second cache set (e.g., see cache sets 1610 a to 1610 b and sets1710 a to 1710 b). The cache system can also include a plurality ofregisters associated with the plurality of cache sets respectively (suchas registers 612 a to 612 c, 1012 a to 1012 c, 1312 a to 1312 d, 1612 ato 1612 b, or 1712 a to 1712 b). The plurality of registers can includea first register associated with the first cache set and a secondregister associated with the second cache set (e.g., see registers 1612a to 1612 b and registers 1712 a to 1712 b).

The cache system can also include a connection (e.g., see connection 604a) to a command bus (e.g., see command bus 605 a) coupled between thecache system and a processor (e.g., see processors 601 and 1001). Thecache system can also include a connection (e.g., see connection 604 b)to an address bus (e.g., see address bus 605 b) coupled between thecache system and the processor.

The cache system can also include a logic circuit (e.g., see logiccircuits 606 and 1006) coupled to the processor to control the pluralityof cache sets according to the plurality of registers. When theconnection to the address bus receives a memory address (e.g., seememory addresses 102 a to 102 e shown in FIG. 1 and the addresses 102 eand 102 b show in in FIGS. 16 and 17 respectively) from the processor,the logic circuit can be configured to generate an extended tag from atleast the memory address (e.g., see extended tags 1650 and 1750). Also,when the connection to the address bus receives the memory address fromthe processor, the logic circuit can be configured to determine whetherthe generated extended tag (e.g., see extended tags 1650 and 1750)matches with a first extended tag (e.g., see extended tags 1640 a and1740 a) for the first cache set (e.g., see cache sets 1610 a and 1710 a)or a second extended tag (e.g., see extended tags 1640 b and 1740 b) forthe second cache set (e.g., see cache sets 1610 b and 1710 b).

The logic circuit (e.g., see logic circuits 606 and 1006) can also beconfigured to implement a command received in the connection (e.g., seeconnection 604 a) to the command bus (e.g., see command bus 605 a) viathe first cache set (e.g., see cache sets 1610 a and 1710 a) in responseto the generated extended tag (e.g., see extended tags 1650 and 1750)matching with the first extended tag (e.g., see extended tags 1640 a and1740 a) and via the second cache set (e.g., see cache sets 1610 b and1710 b) in response to the generated extended tag matching with thesecond extended tag (e.g., see extended tags 1640 b and 1740 b).

The logic circuit (e.g., see logic circuits 606 and 1006) can also beconfigured to generate the first extended tag (e.g., see extended tags1640 a and 1740 a) from a cache address (e.g., see the blocks labeledTag′ in extended tags 1640 a and 1740 a, as well as the tags 1622 a,1622 b, 1722 a, 1722 b, etc.) of the first cache set (e.g., see cachesets 1610 a and 1710 a) and content (e.g., see the blocks labeled‘Execution Type’ in extended tags 1640 a and 1740 a and the blocklabeled ‘Cache Set Index’ in extended tag 1740 a, as well as executiontype 1632 a and cache set index 1732 a) stored in the first register(e.g., see registers 1612 a and 1712 a). The logic circuit can also beconfigured to generate the second extended tag (e.g., see extended tags1640 b and 1740 b) from a cache address (e.g., see the blocks labeled‘Tag’ in extended tags 1640 b and 1740 b, as well as the tags 1626 a,1626 b, 1726 a, 1726 b, etc.) of the second cache set (e.g., see cachesets 1610 b and 1710 b) and content (e.g., see the blocks labeled‘Execution Type’ in extended tags 1640 b and 1740 b and the blocklabeled ‘Cache Set Index’ in extended tag 1740 b, as well as executiontype 1632 b and cache set index 1732 b) stored in the second register(e.g., see registers 1612 b and 1712 b).

In some embodiments, the cache system (such as the cache system 600 or1000) can further include a connection (e.g., see connection 604 d) toan execution-type signal line (e.g., see execution-type signal line 605d) from the processor (e.g., see processors 601 and 1001) identifying anexecution type. In such embodiments, the logic circuit (e.g., see logiccircuits 606 and 1006) can be configured to generate the extended tag(e.g., see extended tags 1650 and 1750) from the memory address (e.g.,see memory addresses 102 e and 102 b shown in FIGS. 16 and 17respectively) and an execution type (e.g., see execution type 110 eshown in FIGS. 16 and 17) identified by the execution-type signal line.Also, in such embodiments, the content stored in each of the firstregister and the second register (e.g., see registers 1612 a, 1612 b,1712 a, and 1712 b) can include an execution type (e.g., see firstexecution type 1632 a and second execution type 1632 b).

In some embodiments, for the determination of whether the generatedextended tag (e.g., see extended tags 1650 and 1750) matches with thefirst extended tag for the first cache set (e.g., see extended tags 1640a and 1740 a) or the second extended tag for the second cache set (e.g.,see extended tags 1640 b and 1740 b), the logic circuit (e.g., see logiccircuits 606 and 1006) can be configured to compare the first extendedtag (e.g., see extended tags 1640 a and 1740 a) with the generatedextended tag (e.g., see extended tags 1650 and 1750) to determine acache hit or miss for the first cache set (e.g., see cache sets 1610 aand 1710 a). Specifically, as shown in FIGS. 16 and 17, a first tagcompare circuit (e.g., see tag compare circuits 1660 a and 1760 a) isconfigured to receive as input the first extended tag (e.g., seeextended tags 1640 a and 1740 a) and the generated extended tag (e.g.,see extended tags 1650 and 1750). The first tag compare circuit (e.g.,see tag compare circuits 1660 a and 1760 a) is also configured tocompare the first extended tag with the generated extended tag todetermine a cache hit or miss for the first cache set. The first tagcompare circuit (e.g., see tag compare circuits 1660 a and 1760 a) isalso configured to output the determined cache hit or miss for the firstcache set (e.g., see outputs 1662 a and 1762 a).

Also, for the determination of whether the generated extended tagmatches with the first extended tag for the first cache set or thesecond extended tag for the second cache set, the logic circuit can beconfigured to compare the second extended tag (e.g., see extended tags1640 b and 1740 b) with the generated extended tag (e.g., see extendedtags 1650 and 1750) to determine a cache hit or miss for the secondcache set (e.g., see cache sets 1610 b and 1710 b). Specifically, asshown in FIGS. 16 and 17, a second tag compare circuit (e.g., see tagcompare circuits 1660 b and 1760 b) is configured to receive as inputthe second extended tag (e.g., see extended tags 1640 b and 1740 b) andthe generated extended tag (e.g., see extended tags 1650 and 1750). Thesecond tag compare circuit (e.g., see tag compare circuits 1660 b and1760 b) is also configured to compare the second extended tag with thegenerated extended tag to determine a cache hit or miss for the secondcache set. The second tag compare circuit (e.g., see tag comparecircuits 1660 b and 1760 b) is also configured to output the determinedcache hit or miss for the second cache set (e.g., see outputs 1662 b and1762 b).

In some embodiments, the logic circuit (e.g., see logic circuits 606 and1006) can be further configured to receive output from the first cacheset (e.g., see cache sets 1610 a and 1710 a) when the logic circuitdetermines the generated extended tag (e.g., see extended tags 1640 aand 1740 a) matches with the first extended tag for the first cache set(e.g., see extended tags 1640 a and 1740 a). The logic circuit can alsobe further configured to receive output from the second cache set (e.g.,see cache sets 1610 b and 1710 b) when the logic circuit determines thegenerated extended tag (e.g., see cache sets 1610 a and 1710 a) matcheswith the second extended tag for the second cache set (e.g., seeextended tags 1640 a and 1740 a).

In some embodiments, the cache address of the first cache set includes afirst tag (e.g., see tags 1622 a, 1622 b, 1722 a, and 1722 b) of a cacheblock (e.g., see cache block 1624 a, 1624 b, 1724 a, and 1724 b) in thefirst cache set (e.g., see cache sets 1610 a and 1710 a). In suchembodiments, the cache address of the second cache set includes a secondtag (e.g., see tags 1626 a, 1626 b, 1726 a, and 1726 b) of a cache block(e.g., see cache block 1628 a, 1628 b, 1728 a, and 1728 b) in the secondcache set (e.g., see cache sets 1610 b and 1710 b). Also, in suchembodiments, in general, the block index is used as an address withinindividual cache sets. For instance, in such embodiments, the logiccircuit (e.g. see logic circuits 606 and 1006) can be configured to usea first block index from the memory address (e.g. see block indexes 106e and 106 b from memory addresses 102 e and 102 b shown in FIGS. 16 and17 respectively) to get a first cache block in the first cache set and atag associated with the first cache block (e.g., see cache block 1624 a,1624 b, 1724 a, and 1724 b and respective associated tags 1622 a, 1622b, 1722 a, and 1722 b). Also, the logic circuit (e.g. see logic circuits606 and 1006) can be configured to use a second block index from thememory address (e.g. see block indexes 106 e and 106 b from memoryaddresses 102 e and 102 b shown in FIGS. 16 and 17 respectively) to geta second cache block in the second cache set and a tag associated withthe second cache block (e.g., see cache block 1628 a, 1628 b, 1728 a,and 1728 b and respective associated tags 1626 a, 1626 b, 1726 a, and1726 b).

In some embodiments, such as the embodiments illustrated in FIG. 16,when the first and second cache sets (e.g., see cache sets 1610 a and1610 b) are in a first state, the cache address of the first cache set(e.g., see tags 1622 a, 1622 b, etc.) includes a first cache setindicator associated with the first cache set. The first cache setindicator can be a first cache set index. In such embodiments, when thefirst and second cache sets are in a first state, the cache address ofthe second cache set (e.g., see tags 1626 a, 1626 b, etc.) includes asecond cache set indicator associated with the second cache set. Thesecond cache set indicator can be a second cache set index.

Also, in the embodiments shown in FIG. 16, when the first and secondcache sets (e.g., see cache sets 1610 a and 1610 b) are in a secondstate (which is not depicted in FIG. 16), the cache address of the firstcache set includes the second cache set indicator associated with thesecond cache set. Further, when the first and second cache sets are inthe second state, the cache address of the second cache set includes thefirst cache set indicator associated with the first cache set. Thischanging of the content within the cache addresses can implement theinterchangeability between the cache sets.

With the embodiments shown in FIG. 16, cache set indicators are repeatedin the tags of each cache block in the cache sets and thus, the tags arelonger than the tags of each cache block in the cache sets depicted inFIG. 17. In FIG. 17, instead of repeating the cache set indexes in thetags of each cache block, the set indexes are stored in the cache setregisters associated with cache sets (e.g., see registers 1712 a and1712 b).

In some embodiments, such as the embodiments illustrated in FIG. 17,when the first and second cache sets (e.g., see cache sets 1710 a and1710 b) are in a first state, the cache address of the first cache set(e.g., see tags 1722 a, 1722 b, etc.) may not include a first cache setindicator associated with the first cache set. Instead, the first cacheset indicator is shown being stored in the first cache set register 1712a (e.g., see the first cache set index 1732 a held in cache set register1712 a). This can reduce the size of the tags for the cache blocks inthe first cache set since the cache set indicator is stored in aregister associate with the first cache set. Also, when the first andsecond cache sets are in the first state, the cache address of thesecond cache set (e.g., see tags 1726 a, 1726 b, etc.) may not include asecond cache set indicator associated with the second cache set.Instead, the second cache set indicator is shown being stored in thesecond cache set register 1712 b (e.g., see the second cache set index1732 b held in cache set register 1712 b). This can reduce the size ofthe tags for the cache blocks in the second cache set since the cacheset indicator is stored in a register associate with the second cacheset.

Also, in the embodiments shown in FIG. 17, when the first and secondcache sets (e.g., see cache sets 1710 a and 1710 b) are in a secondstate (which is not depicted in FIG. 17), the cache address of the firstcache set (e.g., see tags 1722 a, 1722 b, etc.) may not include a secondcache set indicator associated with the second cache set. Instead, thesecond cache set indicator would be stored in the first cache setregister 1712 a. Also, when the first and second cache sets are in thesecond state, the cache address of the second cache set (e.g., see tags1726 a, 1726 b, etc.) may not include a first cache set indicatorassociated with the first cache set. Instead, the first cache setindicator would be stored in the second cache set register 1712 b. Thischanging of the content of the cache set registers can implement theinterchangeability between the cache sets.

In some embodiments, as shown in FIG. 17, when the first and secondregisters (e.g., see registers 1712 a and 1712 b) are in a first state,the content stored in the first register (e.g., see register 1712 a) caninclude a first cache set index (e.g., see cache set index 1732 a)associated with the first cache set (e.g., see cache set 1710 a). And,the content stored in the second register (e.g., see register 1712 b)can include a second cache set index (e.g., see cache set index 1732 b)associated with the second cache set (e.g., see cache set 1710 a). Insuch embodiments, although not depicted in FIG. 17, when the first andsecond registers are in a second state, the content stored in the firstregister can include the second cache set index associated with thesecond cache set, and the content stored in the second register canincluded the first cache set index associated with the first cache set.

In some embodiments, such as embodiments as shown in FIG. 16 and such asembodiments having the connection to the execution-type signal lineidentifying an execution type, the cache system (e.g., see cache system1000) can further include a connection (e.g., see connection 1002) to aspeculation-status signal line (e.g., see speculation-status signal line1004) from the processor (e.g., see processor 1001) identifying a statusof a speculative execution of instructions by the processor. In suchembodiments, the connection to the speculation-status signal line can beconfigured to receive the status of a speculative execution. The statusof a speculative execution can indicate that a result of a speculativeexecution is to be accepted or rejected. When the execution type changesfrom the speculative execution to a non-speculative execution, the logiccircuit can be configured to change the state of the first and secondcache sets (e.g., see caches sets 1610 a and 1610 b), if the status ofspeculative execution indicates that a result of speculative executionis to be accepted. And, when the execution type changes from thespeculative execution to a non-speculative execution, the logic circuitcan be configured to maintain the state of the first and second cachesets (e.g., see caches sets 1610 a and 1610 b) without changes, if thestatus of speculative execution indicates that a result of speculativeexecution is to be rejected.

Somewhat similarly, in some embodiments, such as embodiments as shown inFIG. 17 and such as embodiments having the connection to theexecution-type signal line identifying an execution type, the cachesystem can further include a connection to a speculation-status signalline from the processor identifying a status of a speculative executionof instructions by the processor. In such embodiments, the connection tothe speculation-status signal line can be configured to receive thestatus of a speculative execution. The status of a speculative executioncan indicate that a result of a speculative execution is to be acceptedor rejected. When the execution type changes from the speculativeexecution to a non-speculative execution, the logic circuit can beconfigured to change the state of the first and second cache sets (e.g.,see caches sets 1610 a and 1610 b), if the status of speculativeexecution indicates that a result of speculative execution is to beaccepted. And, when the execution type changes from the speculativeexecution to a non-speculative execution, the logic circuit can beconfigured to change the state of the first and second registers (e.g.,see registers 1712 a and 1712 b), if the status of speculative executionindicates that a result of speculative execution is to be accepted. And,when the execution type changes from the speculative execution to anon-speculative execution, the logic circuit can be configured tomaintain the state of the first and second registers (e.g., seeregisters 1712 a and 1712 b) without changes, if the status ofspeculative execution indicates that a result of speculative executionis to be rejected.

In some embodiments, a cache system can include a plurality of cachesets, including a first cache set and a second cache set. The cachesystem can also include a plurality of registers associated with theplurality of cache sets respectively, including a first registerassociated with the first cache set and a second register associatedwith the second cache set. The cache system can further include aconnection to a command bus coupled between the cache system and aprocessor, a connection to an address bus coupled between the cachesystem and the processor, and a logic circuit coupled to the processorto control the plurality of cache sets according to the plurality ofregisters. The logic circuit can be configured to generate the firstextended tag from a cache address of the first cache set and contentstored in the first register, and to generate the second extended tagfrom a cache address of the second cache set and content stored in thesecond register. The logic circuit can also be configured to determinewhether the first extended tag for the first cache set or the secondextended tag for the second cache set matches with a generated extendedtag generated from a memory address received from the processor. And,the logic circuit can be configured to implement a command received inthe connection to the command bus via the first cache set in response tothe generated extended tag matching with the first extended tag and viathe second cache set in response to the generated extended tag matchingwith the second extended tag.

In such embodiments, cache system can also include a connection to anaddress bus coupled between the cache system and the processor. When theconnection to the address bus receives the memory address from theprocessor, the logic circuit can be configured to generate the extendedtag from at least the memory address. Also, the cache system can includea connection to an execution-type signal line from the processoridentifying an execution type. In such examples, the logic circuit canbe configured to generate the extended tag from the memory address andan execution type identified by the execution-type signal line. Also,the content stored in each of the first register and the second caninclude an execution type.

Further, for the determination of whether the generated extended tagmatches with the first extended tag for the first cache set or thesecond extended tag for the second cache set, the logic circuit can beconfigured to: compare the first extended tag with the generatedextended tag to determine a cache hit or miss for the first cache set;and compare the second extended tag with the generated extended tag todetermine a cache hit or miss for the second cache set. Also, the logiccircuit can be configured to: receive output from the first cache setwhen the logic circuit determines the generated extended tag matcheswith the first extended tag for the first cache set; and receive outputfrom the second cache set when the logic circuit determines thegenerated extended tag matches with the second extended tag for thesecond cache set. In such embodiments and others, the cache address ofthe first cache set can include a first tag of a cache block in thefirst cache set, and the cache address of the second cache set caninclude a second tag of a cache block in the second cache set.

In some embodiments, a cache system can include a plurality of cachesets, including a first cache set and a second cache set. The cachesystem can also include a plurality of registers associated with theplurality of cache sets respectively, including a first registerassociated with the first cache set and a second register associatedwith the second cache set. And, the cache system can include aconnection to a command bus coupled between the cache system and aprocessor, a connection to an execution-type signal line from aprocessor identifying an execution type, a connection to an address buscoupled between the cache system and the processor, and a logic circuitcoupled to the processor to control the plurality of cache setsaccording to the plurality of registers. When the connection to theaddress bus receives a memory address from the processor, the logiccircuit can be configured to: generate an extended tag from the memoryaddress and an execution type identified by the execution-type signalline; and determine whether the generated extended tag matches with afirst extended tag for the first cache set or a second extended tag forthe second cache set. Also, the logic circuit can be configured toimplement a command received in the connection to the command bus viathe first cache set in response to the generated extended tag matchingwith the first extended tag and via the second cache set in response tothe generated extended tag matching with the second extended tag.

FIG. 18 shows example aspects of an example computing device having acache system (e.g., see cache systems 600 and 1000 shown in FIGS. 6 and10 respectively) having interchangeable cache sets (e.g., see cache sets1810 a, 1810 b, and 1810 c) utilizing a mapping circuit 1830 to mapphysical cache set outputs (e.g., see physical outputs 1820 a, 1820 b,and 1820 c) to logical cache set outputs (e.g., see logical outputs 1840a, 1840 b, and 1840 c), in accordance with some embodiments of thepresent disclosure.

As shown, the cache system can include a plurality of cache sets (e.g.,see cache sets 1810 a, 1810 b, and 1810 c). The plurality of cache setsincludes a first cache set (e.g., see cache set 1810 a) configured toprovide a first physical output (e.g., see physical output 1820 a) upona cache hit and a second cache set (e.g., see cache set 1810 b)configured to provide a second physical output (e.g., see physicaloutput 1820 b) upon a cache hit. The cache system can also include aconnection (e.g., see connection 605 a depicted in FIGS. 6 and 10) to acommand bus (e.g., see command bus 605 a) coupled between the cachesystem and a processor (e.g., see processors 601 and 1001). The cachesystem can also include a connection (e.g., see connection 605 b) to anaddress bus (e.g., see address bus 605 b) coupled between the cachesystem and the processor.

Shown in FIG. 18, the cache system includes a control register 1832(e.g., a physical-to-logical-set-mapping (PLSM) register 1832), andmapping circuit 1830 coupled to the control register to map respectivephysical outputs (e.g., see physical outputs 1820 a, 1820 b, and 1820 c)of the plurality of cache sets (e.g., see cache sets 1810 a, 1810 b, and1810 c) to a first logical cache (e.g., a normal cache) and a secondlogical cache (e.g., a shadow cache) as corresponding logical cache setoutputs (e.g., see logical outputs 1840 a, 1840 b, and 1840 c). Themapping, by the mapping circuit 1830, of the physical outputs (e.g., seephysical outputs 1820 a, 1820 b, and 1820 c) to logical cache setoutputs (e.g., see logical outputs 1840 a, 1840 b, and 1840 c) isaccording to a state of the control register 1832. As shown in FIG. 18,at least the logical outputs 1840 a and 1840 b are mapped to the firstlogical cache for the first type of execution, and at least the logicaloutput 1840 c is mapped to the second logical cache for the second typeof execution. Not shown, the cache system can be configured to becoupled between the processor and a memory system (e.g., see memorysystem 603).

When the connection (e.g., see connection 605 b) to the address bus(e.g., see address bus 605 b) receives a memory address (e.g., seememory address 102 b) from the processor (e.g., see processors 601 and1001) and when the control register 1832 is in a first state (shown inFIG. 18), the mapping circuit 1830 can be configured to map the firstphysical output (e.g., see physical output 1820 a) to the first logicalcache for a first type of execution by the processor (e.g., see logicaloutput 1840 a) to implement commands received from the command bus(e.g., see command bus 605 a) for accessing the memory system (e.g., seememory system 601) via the first cache set (e.g., cache set 1820 a)during the first type of execution (e.g., non-speculative execution).

Also, when the connection (e.g., see connection 605 b) to the addressbus (e.g., see address bus 605 b) receives a memory address (e.g., seememory address 102 b) from the processor (e.g., see processors 601 and1001) and when the control register 1832 is in a first state (shown inFIG. 18), the mapping circuit 1830 can be configured to map the secondphysical output (e.g., see physical output 1820 b) to the second logicalcache for a second type of execution by the processor (e.g., see logicaloutput 1840 b) to implement commands received from the command bus(e.g., see command bus 605 a) for accessing the memory system (e.g., seememory system 601) via the second cache set (e.g., cache set 1820 b)during the second type of execution (e.g., speculative execution).

When the connection (e.g., see connection 605 b) to the address bus(e.g., see address bus 605 b) receives a memory address (e.g., seememory address 102 b) from the processor (e.g., see processors 601 and1001) and when the control register 1832 is in a second state (not shownin FIG. 18), the mapping circuit 1830 is configured to map the firstphysical output (e.g., see physical output 1820 a) to the second logicalcache (e.g., see logical output 1840 b) to implement commands receivedfrom the command bus (e.g., see command bus 605 a) for accessing thememory system (e.g., see memory system 601) via the first cache set(e.g., cache set 1820 a) during the second type of execution (e.g.,speculative execution).

Also, when the connection (e.g., see connection 605 b) to the addressbus (e.g., see address bus 605 b) receives a memory address (e.g., seememory address 102 b) from the processor (e.g., see processors 601 and1001) and when the control register 1832 is in the second state (notshown in FIG. 18), the mapping circuit 1830 is configured to map thesecond physical output (e.g., see physical output 1820 b) to the firstlogical cache (e.g., see logical output 1840 a) to implement commandsreceived from the command bus (e.g., see command bus 605 a) foraccessing the memory system (e.g., see memory system 601) via the secondcache set (e.g., cache set 1820 b) for the first type of execution(e.g., non-speculative execution).

In some embodiments, the first logical cache is a normal cache fornon-speculative execution by the processor, and the second logical cacheis a shadow cache for speculative execution by the processor.

The mapping circuit 1830 solves the problem related to the executiontype. Mapping circuit 1830 provides a solution to the how the executiontype relates to mapping physical to logical cache sets. If the mappingcircuit 1830 is used, a memory address (e.g., see address 102 b) can beapplied in each cache set (e.g., see cache sets 1810 a, 1810 b, and 1810c) to generate a physical output (e.g., see physical outputs 1820 a,1820 b, and 1820 c). The physical output (e.g., see physical outputs1820 a, 1820 b, and 1820 c) includes the tag and the cache block thatare looked up using a block index of the memory address (e.g., see blockindex 106 b). The mapping circuit 1830 can reroute the physical output(e.g., see physical outputs 1820 a, 1820 b, and 1820 c) to one of thelogical output (e.g., see logical outputs 1840 a, 1840 b, and 1840 c).The cache system can do a tag compare at the physical output or at thelogical output. If the tag compare is done at the physical output, thetag hit or miss of the physical output is routed through the mappingcircuit 1830 to generate a hit or miss of the logical output. Otherwise,the tag itself is routed through the mapping circuit 1830; and a tagcompare is performed at the logical output to generate the correspondingtag hit or miss result.

As illustrated in FIG. 18, the logical outputs are predefined forspeculative execution and non-speculative execution. Therefore, thecurrent execution type (e.g., see execution type 110 e) can be used toselect which part of the logical outputs is to be used. For example,since it is pre-defined that the logical output 1840 c is forspeculative execution in FIG. 18, it results can be discarded if thecurrent execution type is normal execution. Otherwise, if the currentexecution type is speculative, the results from the first part of thelogical outputs in FIG. 18 (e.g., outputs 1840 a and 1840 b) can beblocked.

In the embodiment shown in FIG. 18, if the current execution type isspeculative, the hit or miss results from the logical outputs for thenon-speculative execution can be AND'ed with ‘0’ to force a cache“miss”; and the hit or miss results from the logical outputs for thenon-speculative execution can be AND'ed with ‘1’ to keep the resultsunaltered. Execution type 110 e can be configured such that speculativeexecution=0 and non-speculative execution=1, and the tag hit or missresults from non-speculative outputs 1840 a to 1840 b can be AND'ed withexecution type (e.g., execution type 110 e) to generate the hit or missthat includes the consideration of matching both the tag and theexecution type. And, the tag hit or miss results from 1840 c can beAND'ed with the inverse of the execution type 110 e to generate the hitor miss.

FIGS. 19 and 20 show example aspects of example computing devices havingcache systems (e.g., see cache systems 600 and 1000 shown in FIGS. 6 and10 respectively) having interchangeable cache sets (e.g., see cache sets1810 a, 1810 b, and 1810 c depicted in FIGS. 18 to 21) utilizing thecircuit shown in FIG. 18, the mapping circuit 1830, to map physicalcache set outputs (e.g., see physical outputs 1820 a, 1820 b, and 1820 cdepicted in FIG. 18 as well as physical output 1820 a shown in FIG. 19)to logical cache set outputs (e.g., see logical outputs 1840 a, 1840 b,and 1840 c), in accordance with some embodiments of the presentdisclosure.

In particular, FIG. 19 shows the first cache set 1810 a, the first cacheset register 1812 a, the tag 1815 a for the first cache set (whichincludes a current tag and cache set index), the tag and set index 1850from the address 102 b (which includes a current tag 104 b and a currentcache set index 112 b from memory address 102 b), and the tag comparecircuit 1860 a for the first cache set 1810 a. Also, FIG. 19 shows thefirst cache set 1810 a having cache blocks and associated tags (e.g.,see cache blocks 1818 a and 1818 b and tags 1816 a and 1816 b) as wellas the first cache set register 1812 a holding a cache set index 1813 afor the first cache set. Further, FIG. 19 shows the tag compare circuit1860 b for the second cache set 1810 b. The figure shows the physicaloutput 1820 a from the first cache set 1810 a being outputted to themapping circuit 1830. The second cache set 1810 b and other cache setsof the system can provide their respective physical outputs to themapping circuit 1830 as well (although this is not depicted in FIG. 19).

FIG. 20 shows an example of multiple cache sets of the system providingphysical outputs to the mapping circuit 1830 (e.g., see physical outputs1820 a, 1820 b, and 1820 c provided by cache sets 1810 a, 1810 b, and1810 c, respectively, as shown in FIG. 20). FIG. 20 also depicts partsof the mapping circuit 1830 (e.g., see multiplexors 2004 a, 2004 b, and2004 c as well as PLSM registers 2006 a, 2006 b, and 2006 c). FIG. 20also shows the first cache 1810 a having at least cache blocks 1818 aand 1818 b and associated tags 1816 a and 1816 b. And, the second cache1810 b is also shown having at least cache blocks 1818 c and 1818 d andassociated tags 1816 c and 1816 d.

FIG. 19 also shows multiplexors 1904 a and 1904 b as well as PLSMregisters 1906 a and 1906 b, which can be parts of a logic circuit(e.g., see logic circuits 606 and 1006) and/or a mapping circuit (e.g.,see mapping circuit 1830). Each of the multiplexors 1904 a and 1904 breceive at least hit or miss results 1862 a and 1862 b from tag comparecircuits 1860 a and 1860 b which each compare respective tags for cachesets (e.g., see tag for the first cache set 1815 a) against the tag andset index from the memory address (e.g., see tag and set index 1850). Insome examples, there can be equivalent multiplexors for each tag comparefor each cache set of the system. Each of the multiplexors (e.g., seemultiplexors 1904 a and 1904 b) can output a selected hit or miss resultbased on the state of the multiplexor's respective PLSM register (e.g.,see PLSM registers 1906 a and 1906 b). The PLSM registers controllingthe selection of the multiplexors for outputting the cache hits ormisses from the cache set comparisons can be controlled by a master PLSMregister such as control register 1832 when such registers are a part ofthe mapping circuit 1830.

In some embodiments, each of the PLSM registers (e.g., see PLSMregisters 1906 a and 1906 b as well as PLSM registers 2110 a, 2110 b,and 2110 c depicted in FIG. 21) can be a one-, two-, or three-bitregister or any bit length register depending on the specificimplementation. Such PLSM registers can be used (such as used by amultiplexor) to select the appropriate physical tag compare result orthe correct result of one of logic units outputting hits or misses.

For the case of the PLSM registers 2006 a, 2006 b, and 2006 c depictedin FIG. 20, such registers can be used (such as used by a multiplexor)to select the appropriate physical outputs (e.g., see physical outputs1820 a, 1820 b, and 1820 c shown in FIG. 20) of cache sets (e.g., seecache sets 1810 a, 1810 b, and 1810 c as shown in FIG. 20). Such PLSMregisters can also each be a one-, two-, or three-bit register or anybit length register depending on the specific implementation. Also, thecontrol register 1832 can be a one-, two-, or three-bit register or anybit length register depending on the specific implementation.

In some embodiments, selections of physical outputs from cache sets orselections of cache hits or misses are by multiplexors that can bearranged in the system to have at least one multiplexor per type ofoutput and per logic unit or per cache set (e.g., see multiplexors 1904a and 1904 b shown in FIG. 19, multiplexors 2004 a, 2004 b, and 2004 cshown in FIG. 20, and multiplexors 2110 a, 2110 b, and 2110 c shown inFIG. 21). As shown in the figures, in some embodiments, where there isan n number of cache sets or logic compare units, there are an n numberof n-to-1 multiplexors.

As shown in FIG. 19, the computing device can include a firstmultiplexor (e.g., multiplexor 1904 a) configured to output, to theprocessor, the first hit-or-miss result or the second hit-or-miss result(e.g., see hit or miss outputs 1862 a and 1862 b as shown in FIG. 19)according to the content received by the first PLSM register (e.g., seePLSM register 1906 a). The computing device can also include a secondmultiplexor (e.g., multiplexor 1904 b) configured to output, to theprocessor, the second hit-or-miss result or the first hit-or-miss result(e.g., see hit or miss outputs 1862 b and 1862 a as shown in FIG. 19)according to the content received by the second PLSM register (e.g., seePLSM register 1906 b).

In some embodiments, the contents of the PLSM registers can be receivedfrom a control register such as control register 1832 shown in FIG. 18.For example, in some embodiments, when the content received by the firstPLSM register indicates a first state, the first multiplexor outputs thefirst hit-or-miss result, and when the content received by the firstPLSM register indicates a second state, the first multiplexor outputsthe second hit-or-miss result. Also, when the content received by thesecond PLSM register indicates the first state, the second multiplexorcan output the second hit-or-miss result. And, when the content receivedby the second PLSM register indicates the second state, the secondmultiplexor can output the first hit-or-miss result.

As shown in FIG. 20, the computing device can include a firstmultiplexor (e.g., multiplexor 2004 a) configured to output, to theprocessor, the first physical output of the first cache set 1820 a orthe second physical output of the second cache set 1820 b according tothe content received by the first PLSM register (e.g., PLSM register2006 a). The computing device can include a second multiplexor (e.g.,multiplexor 2004 b) configured to output, to the processor, the firstphysical output 1820 a of the first cache set or the second physicaloutput 1820 b of the second cache set according to the content receivedby the second PLSM register (e.g., PLSM register 2006 b).

In some embodiments, the contents of the PLSM registers can be receivedfrom a control register such as control register 1832 shown in FIG. 18.For example, in some embodiments, when the content received by the firstPLSM register indicates a first state, the first multiplexor outputs thefirst physical output 1820 a, and when the content received by the firstPLSM register indicates a second state, the first multiplexor outputsthe second physical output 1820 b. Also, when the content received bythe second PLSM register indicates the first state, the secondmultiplexor can output the second physical output 1820 b. And, when thecontent received by the second PLSM register indicates the second state,the second multiplexor can output the first physical output 1820 a.

In some embodiments, block selection can be based on a combination of ablock index and a main or shadow setting. Such parameters can controlthe PLSM registers.

In some embodiments, such as the example shown in FIGS. 19 and 20, onlyone address (e.g., tag and index) are fed into the interchangeable cachesets (e.g., cache sets 1810 a, 1810 b and 1810 c). In such embodiments,there is a signal controlling which cache set is updated according tomemory if that cache set produces a miss.

Multiplexor 1904 a is controlled by the PLSM register 1906 a to providehit or miss output of cache set 1810 a and thus the hit or miss statusof the cache set for the main or normal execution, when the cache setsare in a first state. Multiplexor 1904 b is controlled by the PLSMregister 1906 b to provide hit or miss output of cache set 1810 b andthus the hit or miss status of the cache set for the speculativeexecution, when the cache sets are in the first state. On the otherhand, multiplexor 1904 a is controlled by the PLSM register 1906 a toprovide hit or miss output of cache set 1810 b and thus the hit or missstatus of the cache set for the main or normal execution, when the cachesets are in a second state. Multiplexor 1904 b is controlled by the PLSMregister 1906 b to provide hit or miss output of cache set 1810 a andthus the hit or miss status of the cache set for the speculativeexecution, when the cache sets are in the second state.

Similar to the selection of hit or miss signals, the data looked up fromthe interchangeable caches can be selected to produce one result for theprocessor (such as if there is a hit), for example see physical outputs1820 a, 1820 b, and 1820 c shown in FIG. 20.

For example, in a first state of the cache sets, when cache set 1810 ais used as main cache set and cache set 1810 b is used as shadow cacheset, the multiplexor 2004 a is controlled by the PLSM register 2006 a toselect the physical output 1820 a of cache set 1810 a for the main ornormal logical cache used for non-speculative executions. Also, forexample, in a second state of the cache sets, when cache set 1810 b isused as main cache set and cache set 1810 a is used as shadow cache set,then the multiplexor 2004 a is controlled by the PLSM register 2006 a toselect the physical output 1820 b of cache set 1810 b for the main ornormal logical cache used for non-speculative executions. In suchexamples, in the first state of the cache sets, when cache set 1810 a isused as main cache set and cache set 1810 b is used as shadow cache set,then the multiplexor 2004 b is controlled by the PLSM register 2006 b toselect the physical output 1820 b of cache set 1810 b for the shadowlogical cache used for speculative executions. Also, for example, in thesecond state of the cache sets, when cache set 1810 a is used as maincache set and cache set 1810 b is used as shadow cache set, then themultiplexor 2004 b is controlled by the PLSM register 2006 b to selectthe physical output 1820 a of cache set 1810 a for the shadow logicalcache used for speculative executions.

In some embodiments, the cache system can further include a plurality ofregisters (e.g., see register 1812 a as shown in FIG. 19) associatedwith the plurality of cache sets respectively (e.g., see cache sets 1810a, 1810 b, and 1810 c as shown in FIGS. 18 to 21). The registers caninclude a first register (e.g., see register 1812 a) associated with thefirst cache set (e.g., see cache set 1810 a) and a second register (notdepicted in FIGS. 18 to 21 but depicted in FIGS. 6 and 10) associatedwith the second cache set (e.g., see cache set 1810 b). The cache systemcan also include a logic circuit (e.g., see logic circuits 606 and 1006)coupled to the processor (e.g., see logic circuits 601 and 1001) tocontrol the plurality of cache sets according to the plurality ofregisters. When the connection (e.g., see connection 604 b) to theaddress bus (e.g., see address bus 605 b) receives a memory address fromthe processor, the logic circuit can be configured to generate a setindex from at least the memory address and determine whether thegenerated set index matches with a content stored in the first registeror with a content stored in the second register. And, the logic circuitcan be configured to implement a command received in the connection(e.g., see connection 604 a) to the command bus (e.g., see command bus605 a) via the first cache set in response to the generated set indexmatching with the content stored in the first register and via thesecond cache set in response to the generated set index matching withthe content stored in the second register.

In some embodiments, the mapping circuit (e.g., see mapping circuit1830) can be a part of or connected to the logic circuit and the stateof the control register (e.g., see control register 1832) can control astate of a cache set of the plurality of cache sets. In someembodiments, the state of the control register can control the state ofa cache set of the plurality of cache sets by changing a valid bit foreach block of the cache set (e.g., see FIGS. 21 to 23).

Also, in some examples, the cache system can further include aconnection (e.g., see connection 1002) to a speculation-status signalline (e.g., see speculation-status signal line 1004) from the processoridentifying a status of a speculative execution of instructions by theprocessor. The connection to the speculation-status signal line can beconfigured to receive the status of a speculative execution, and thestatus of a speculative execution can indicate that a result of aspeculative execution is to be accepted or rejected. When the executiontype changes from the speculative execution to a non-speculativeexecution, the logic circuit (e.g., see logic circuits 606 and 1006) canbe configured to change, via the control register (e.g., see controlregister 1832), the state of the first and second cache sets, if thestatus of speculative execution indicates that a result of speculativeexecution is to be accepted. And, when the execution type changes fromthe speculative execution to a non-speculative execution, the logiccircuit can be configured to maintain, via the control register, thestate of the first and second cache sets without changes, if the statusof speculative execution indicates that a result of speculativeexecution is to be rejected.

In some embodiments, the mapping circuit (e.g., see mapping circuit1830) is part of or connected to the logic circuit (e.g., see logiccircuits 606 and 1006) and the state of the control register (e.g., seecontrol register 1832) can control a state of a cache register of theplurality of cache registers (e.g., see register 1812 a as shown in FIG.19) via the mapping circuit. In such examples, the cache system canfurther include a connection (e.g., see connection 1002) to aspeculation-status signal line (e.g., see speculation-status signal line1004) from the processor identifying a status of a speculative executionof instructions by the processor. The connection to thespeculation-status signal line can be configured to receive the statusof a speculative execution, and the status of a speculative executionindicates that a result of a speculative execution is to be accepted orrejected. When the execution type changes from the speculative executionto a non-speculative execution, the logic circuit can be configured tochange, via the control register, the state of the first and secondregisters, if the status of speculative execution indicates that aresult of speculative execution is to be accepted. And, when theexecution type changes from the speculative execution to anon-speculative execution, the logic circuit can be configured tomaintain, via the control register, the state of the first and secondregisters without changes, if the status of speculative executionindicates that a result of speculative execution is to be rejected.

FIG. 21 shows example aspects of example computing device having a cachesystem having interchangeable cache sets (such as the cache sets shownin FIG. 18, including cache sets 1810 a, 1810 b, and 1810 c), inaccordance with some embodiments of the present disclosure. The cachesets (e.g., cache sets 1810 a, 1810 b, and 1810 c) are shown utilizingthe circuit shown in FIG. 18, mapping circuit 1830, to map physicalcache set outputs to logical cache set outputs.

The parts depicted in FIG. 21 are part of a computing device thatincludes memory, such as main memory, a processor, e.g., see processor1001, and at least three interchangeable cache sets (e.g., seeinterchangeable cache sets 1810 a, 1810 b, and 1810 c). The processor isconfigured to execute a main thread and a speculative thread.

As shown in FIG. 21, a first cache set (e.g., cache set 1810 a) can becoupled in between the memory and the processor, and can include a firstplurality of blocks (e.g., see blocks 2101 a, 2101 b, and 2101 c shownin FIG. 21) for the main thread, in a first state of the cache set. Eachblock of the first plurality of blocks can include cached data, a firstvalid bit, and a block address including an index and a tag. And, theprocessor, solely or in combination with a cache controller, can beconfigured to change each first valid bit from indicating valid toinvalid when a speculation of the speculative thread is successful sothat the first plurality of blocks becomes accessible for thespeculative thread and blocked for the main thread, in the first stateof the cache set, in a second state of the cache set.

As shown in FIG. 21, a second cache set (e.g., cache set 1810 b) can becoupled in between the main memory and the processor, and can include asecond plurality of blocks (e.g., see blocks 2101 d, 2101 e, and 2101 fshown in FIG. 21) for the speculative thread, in a first state of thecache set. Each block of the second plurality of blocks can includecached data, a second valid bit, and a block address including an indexand a tag. And, the processor, solely or in combination with the cachecontroller, can be configured to change each second valid bit fromindicating invalid to valid when a speculation of the speculative threadis successful so that the second plurality of blocks becomes accessiblefor the main thread and blocked for the speculative thread, in a secondstate of the cache set.

In some embodiments, as shown in FIG. 21, a block of the first pluralityof blocks can correspond to a respective block of the second pluralityblocks. And, the block of the first plurality of blocks can correspondto the respective block of the second plurality blocks by having a sameblock address as the respective block of the second plurality of blocks.

Also, as shown in FIG. 21, the computing device can include a firstphysical-to-logical-mapping-set-mapping (PLSM) register (e.g., PLSMregister 1 2108 a) configured to receive a first valid bit of a block ofthe first plurality of blocks. The first valid bit can be indicative ofthe validity of the cached data of the block of the first plurality ofblocks. It can also be indicative of whether to use, in the main thread,the block of the first plurality of blocks or the corresponding block ofthe second plurality of blocks.

Also, as shown in FIG. 21, the computing device can include a secondPLSM register (e.g., PLSM register 2 2108 b) configured to receive asecond valid bit of a block of the second plurality of blocks. Thesecond valid bit being indicative of the validity of the cached data ofthe block of the second plurality of blocks. It can also be indicativeof whether to use, in the main thread, the block of the second pluralityof blocks or the corresponding block of the first plurality of blocks.

Also, as shown in FIG. 21, the computing device can include a logic unit2104 a for the first cache set, which is configured to determine whethera block of the first plurality of blocks hits or misses. The logic unit2104 a is shown including a comparator 2106 a and an AND gate 2107 a.The comparator 2106 a can determine whether there is a match between thetag of the block and a corresponding tag of the address in memory. And,if the tags match and the valid bit for the block is valid, then the ANDgate 2107 a outputs an indication that the block hits. Otherwise, theAND gate 2107 a outputs an indication that the block misses. To put itanother way, the logic unit 2104 a for the first cache is configured tooutput a first hit-or-miss result according to the determination at thelogic unit.

Also, as shown in FIG. 21, the computing device can include a logic unit2104 b for the second cache set, which is configured to determinewhether a block of the second plurality of blocks hits or misses. Thelogic unit 2104 b is shown including a comparator 2106 b and an AND gate2107 b. The comparator 2106 b can determine whether there is a matchbetween the tag of the block and a corresponding tag of the address inmemory. And, if the tags match and the valid bit for the block is valid,then the AND gate 2107 b outputs an indication that the block hits.Otherwise, the AND gate 2107 b outputs an indication that the blockmisses. To put it another way, the logic unit 2104 b for the secondcache is configured to output a second hit-or-miss result according tothe determination at the logic unit.

Also, as shown in FIG. 21, the computing device can include a firstmultiplexor (e.g., multiplexor 2110 a) configured to output, to theprocessor, the first hit-or-miss result or the second hit-or-miss resultaccording to the first valid bit received by the first PLSM register.The computing device can also include a second multiplexor (e.g.,multiplexor 2110 b) configured to output, to the processor, the secondhit-or-miss result or the first hit-or-miss result according to thesecond valid bit received by the second PLSM register. In someembodiments, when the first valid bit received by the first PLSMregister indicates valid, the first multiplexor outputs the firsthit-or-miss result, and when the first valid bit received by the firstPLSM register indicates invalid, the first multiplexor outputs thesecond hit-or-miss result. Also, when the second valid bit received bythe second PLSM register indicates valid, the second multiplexor outputsthe second hit-or-miss result. And, when the second valid bit receivedby the second PLSM register indicates invalid, the second multiplexoroutputs the first hit-or-miss result.

In some embodiments, block selection can be based on a combination of ablock index and a main or shadow setting.

In some embodiments, only one address (e.g., tag and index) are fed intothe interchangeable cache sets (e.g., cache sets 1810 a, 1810 b and 1810c). In such embodiments, there is a signal controlling which cache setis updated according to memory if that cache set produces a miss.Similar to the selection of hit or miss signals, the data looked up fromthe interchangeable caches can be selected to produce one result for theprocessor (such as if there is a hit). For example, in a first state ofthe cache sets, if cache set 1810 a is used as main cache set and cacheset 1810 b is used as shadow cache set, then the multiplexor 2110 a iscontrolled by the PLSM register 2108 a to select the hit or miss outputof cache set 1804 a and hit or miss status of the main cache set. And,multiplexor 2110 b is controlled by the PLSM register 2108 b to providehit or miss output of cache set 1810 b and thus the hit or miss statusof the shadow cache set.

In such embodiments, when the cache sets are in a second state, whencache set 1810 a is used as shadow cache and cache set 1810 b is used asmain cache, the multiplexor 2110 a can be controlled by the PLSMregister 2108 b to select the hit or miss output of cache set 1810 b andhit or miss status of the main cache. And, multiplexor 2110 b can becontrolled by the PLSM register 2108 b to provide hit or miss output ofcache set 1810 a and thus the hit or miss status of the shadow cache.

Thus, multiplexor 2110 a can output whether the main cache has hit ormiss in the cache for the address; and the multiplexor 2110 b can outputwhether a shadow cache has hit or miss in the cache for the sameaddress. Then, depending on whether or not the address is speculative,the one of the output can be selected. When there is a cache miss, theaddress is used in the memory to load data to a corresponding cache. ThePLSM registers can similarly enable the update of the correspondingcache set 1810 a or set 1810 b.

In some embodiments, in the first state of the cache sets, duringspeculative execution of a first instruction by the speculative thread,effects of the speculative execution are stored within the second cacheset (e.g., cache set 1810 b). During the speculative execution of thefirst instruction, the processor can be configured to assert a signalindicative of the speculative execution which is configured to blockchanges to the first cache set (e.g., cache set 1810 a). When the signalis asserted by the processor, the processor can be further configured toblock the second cache set (e.g., cache set 1810 b) from updating thememory.

When the state of the cache sets changes to the second state, inresponse to a determination that execution of the first instruction isto be performed with the main thread, the second cache set (instead ofthe first cache set) is used with the first instruction. In response toa determination that execution of the first instruction is not to beperformed with the main thread, the first cache set is used with thefirst instruction.

In some embodiments, in the first state, during the speculativeexecution of first instruction, the processor accesses the memory viathe second cache set (e.g., cache set 1810 b). And, during thespeculative execution of one or more instructions, access to content inthe second cache is limited to the speculative execution of the firstinstruction by the processor. During the speculative execution of thefirst instruction, the processor can be prohibited from changing thefirst cache set (e.g., cache set 1810 a).

In some embodiments, the content of the first cache set (e.g., cache set1810 a) and/or the second cache set (e.g., cache set 1810 b) can beaccessible via a cache coherency protocol.

FIGS. 22 and 23 show methods 2200 and 2300, respectively, for usinginterchangeable cache sets for speculative and non-speculativeexecutions by a processor, in accordance with some embodiments of thepresent disclosure. In particular, the methods 2200 and 2300 can beperformed by a computing device illustrated in FIG. 21. Also, somewhatsimilar methods could be performed by the computing device illustratedin FIGS. 18-20 as well as any of the computing devices disclosed herein;however, such computing devices would control cache state, cache setstate, or cache set register state via another parameter besides thevalid bit of a block address. For example, in FIG. 16 a state of thecache set is controlled via a cache set indicator within the tag of ablock of the cache set. And, for example, in FIG. 17, a state of thecache set is controlled via the state of the cache set registerassociated with the cache set. In such an example, the state iscontrolled via the cache set index stored in the cache set register. Onthe other hand, for the embodiments disclosed through FIGS. 21 to 23,the state of a cache set is controlled via the valid bit of a blockaddress within the cache set.

Method 2200 includes, at block 2202, executing, by a processor (e.g.processor 1001), a main thread and a speculative thread. The method2200, at block 2204, includes providing, in a first cache set of a cachesystem coupled in between a memory system and the processor (e.g., cacheset 1810 a as shown in FIG. 21), a first plurality of blocks for themain thread (e.g., blocks 2101 a, 2101 b, and 2101 c depicted in FIG.21). Each block of the first plurality of blocks can include cacheddata, a first valid bit, and a block address having an index and a tag.The method 2200, at block 2206, includes providing, in a second cacheset of the cache system coupled in between the memory system and theprocessor (e.g., cache set 1810 b), a second plurality of blocks for thespeculative thread (e.g., blocks 2101 d, 2101 e, and 2101 f). Each blockof the second plurality of blocks can include cached data, a secondvalid bit, and a block address having an index and a tag.

At block 2207, the method 2200 continues with identifying, such as bythe processor, whether a speculation of the speculative thread issuccessful so that the first plurality of blocks becomes accessible forthe speculative thread and blocked for the main thread and so that thesecond plurality of blocks becomes accessible for the main thread andblocked for the speculative thread. As shown in FIG. 22, if thespeculation of the speculative thread fails, then validity bits of thefirst and second plurality of blocks are not changed by the processorand remain with the same validity values as prior to the determinationof whether the speculative thread was successful at block 2207. Thus,the state of the cache sets does not change from a first state to asecond state.

At block 2208, the method 200 continues with changing, by the processorsolely or in combination with a cache controller, each first valid bitfrom indicating valid to invalid when a speculation of the speculativethread is successful so that the first plurality of blocks becomesaccessible for the speculative thread and blocked for the main thread.Also, at block 2210, the method 200 continues with changing, by theprocessor solely or in combination with the cache controller, eachsecond valid bit from indicating invalid to valid when a speculation ofthe speculative thread is successful so that the second plurality ofblocks becomes accessible for the main thread and blocked for thespeculative thread. Thus, the state of the cache sets does change fromthe first state to the second state.

In some embodiments, during speculative execution of a first instructionby the speculative thread, effects of the speculative execution arestored within the second cache set. In such embodiments, during thespeculative execution of the first instruction, the processor can asserta signal indicative of the speculative execution which can block changesto the first cache. Also, when the signal is asserted by the processor,the processor can block the second cache from updating the memory. Thisoccurs while the cache sets are in the first state.

Also, in such embodiments, in response to a determination that executionof the first instruction is to be performed with the main thread, thesecond cache set (instead of the first cache set) is used with the firstinstruction. In response to a determination that execution of the firstinstruction is not to be performed with the main thread, the first cacheis used with the first instruction. This occurs while the cache sets arein the second state.

In some embodiments, during the speculative execution of firstinstruction, the processor accesses the memory via the second cache.And, during the speculative execution of one or more instructions,access to content in the second cache is limited to the speculativeexecution of the first instruction by the processor. In suchembodiments, during the speculative execution of the first instruction,the processor is prohibited from changing the first cache.

In some embodiments, content of the first cache is accessible via acache coherency protocol.

In FIG. 23, method 2300 includes the operations at blocks 2202, 2204,2206, 2207, 2208, and 2210 of method 2200.

Method 2300, at block 2302, includes receiving, by a firstphysical-to-logical-mapping-set-mapping (PLSM) register (e.g., PLSMregister 2108 a shown in FIG. 21), a first valid bit of a block of thefirst plurality of blocks. The first valid bit can be indicative of thevalidity of the cached data of the block of the first plurality ofblocks. Also, the method 2300, at block 2304, includes receiving, by asecond PLSM register (e.g., PLSM register 2108 b), a second valid bit ofa block of the second plurality of blocks. The second valid bit can beindicative of the validity of the cached data of the block of the secondplurality of blocks.

At block 2306, the method 2300 includes determining, by a first logicunit (e.g., logic unit 2104 a depicted in FIG. 21) for the first cacheset, whether a block of the first plurality of blocks hits or misses. Atblock 2307, the method 2300 continues with outputting, by the firstlogic unit, a first hit-or-miss result according to the determination.Also, at block 2308, the method 2300 includes determining, by a secondlogic unit for the second cache set (e.g., logic unit 2104 b), whether ablock of the second plurality of blocks hits or misses. At block 2309,the method 2300 continues with outputting, by the second logic unit, asecond hit-or-miss result according to the determination.

At block 2310, the method 2300 continues with outputting to theprocessor, by a first multiplexor (e.g., multiplexor 2110 a depicted inFIG. 21), the first hit-or-miss result or the second hit-or-miss resultaccording to the first valid bit received by the first PLSM register. Insome embodiments, when the first valid bit received by the first PLSMregister indicates valid, the first multiplexor outputs the firsthit-or-miss result, and when the first valid bit received by the firstPLSM register indicates invalid, the first multiplexor outputs thesecond hit-or-miss result.

And, at block 2312, outputting to the processor, by a second multiplexor(e.g., multiplexor 2110 b), the second hit-or-miss result or the firsthit-or-miss result according to the second valid bit received by thesecond PLSM register. In some embodiments, when the second valid bitreceived by the second PLSM register indicates valid, the secondmultiplexor outputs the second hit-or-miss result. And, when the secondvalid bit received by the second PLSM register indicates invalid, thesecond multiplexor outputs the first hit-or-miss result.

Some embodiments can include a central processing unit having processingcircuitry configured to execute a main thread and a speculative thread.The central processing unit can also include or be connected to a firstcache set of a cache system configured to couple in between a mainmemory and the processing circuitry, having a first plurality of blocksfor the main thread. Each block of the first plurality of blocks caninclude cached data, a first valid bit, and a block address including anindex and a tag. The processing circuitry, solely or in combination witha cache controller, can be configured to change each first valid bitfrom indicating valid to invalid when a speculation of the speculativethread is successful, so that the first plurality of blocks becomesaccessible for the speculative thread and blocked for the main thread.The central processing unit can also include or be connected to a secondcache set of the cache system coupled in between the main memory and theprocessing circuitry, including a second plurality of blocks for thespeculative thread. Each block of the second plurality of blocks caninclude cached data, a second valid bit, and a block address having anindex and a tag. The processing circuitry, solely or in combination withthe cache controller, can be configured to change each second valid bitfrom indicating invalid to valid when a speculation of the speculativethread is successful, so that the second plurality of blocks becomesaccessible for the main thread and blocked for the speculative thread.And, a block of the first plurality of blocks corresponds to arespective block of the second plurality blocks by having a same blockaddress as the respective block of the second plurality of blocks.

The techniques disclosed herein can be applied to at least to computersystems where processors are separated from memory and processorscommunicate with memory and storage devices via communication busesand/or computer networks. Further, the techniques disclosed herein canbe applied to computer systems in which processing capabilities areintegrated within memory/storage. For example, the processing circuits,including executing units and/or registers of a typical processor, canbe implemented within the integrated circuits and/or the integratedcircuit packages of memory media to performing processing within amemory device. Thus, a processor (e.g., see processor 201, 401, 601, and1001) as discussed above and illustrated in the drawings is notnecessarily a central processing unit in the von Neumann architecture.The processor can be a unit integrated within memory to overcome the vonNeumann bottleneck that limits computing performance as a result of alimit in throughput caused by latency in data moves between a centralprocessing unit and memory configured separately according to the vonNeumann architecture.

The description and drawings of the present disclosure are illustrativeand are not to be construed as limiting. Numerous specific details aredescribed to provide a thorough understanding. However, in certaininstances, well known or conventional details are not described in orderto avoid obscuring the description. References to one or an embodimentin the present disclosure are not necessarily references to the sameembodiment; and, such references mean at least one.

In the foregoing specification, the disclosure has been described withreference to specific exemplary embodiments thereof. It will be evidentthat various modifications can be made thereto without departing fromthe broader spirit and scope as set forth in the following claims. Thespecification and drawings are, accordingly, to be regarded in anillustrative sense rather than a restrictive sense.

What is claimed is:
 1. A cache system, comprising: a first cache; asecond cache; a connection to a command bus coupled between the cachesystem and a processor; a connection to an address bus coupled betweenthe cache system and the processor; a connection to a data bus coupledbetween the cache system and the processor; a connection to anexecution-type signal line from the processor identifying an executiontype; a configurable data bit; a logic circuit coupled to the processorto control the first cache and the second cache based on theconfigurable data bit; wherein the cache system is configured to becoupled between the processor and a memory system; wherein when theconfigurable data bit is in a first state, the logic circuit isconfigured to: implement commands received from the command bus foraccessing the memory system via the first cache, when the execution typeis a first type; and implement commands received from the command busfor accessing the memory system via the second cache, when the executiontype is a second type; and wherein when the configurable data bit is ina second state, the logic circuit is configured to: implement commandsreceived from the command bus for accessing the memory system via thesecond cache, when the execution type is the first type; and implementcommands received from the command bus for accessing the memory systemvia the first cache, when the execution type is the second type.
 2. Thecache system of claim 1, wherein the first type is configured toindicate non-speculative execution of instructions by the processor; andthe second type is configured to indicate speculative execution ofinstructions by the processor.
 3. The cache system of claim 2, furthercomprising: a connection to a speculation-status signal line from theprocessor identifying a status of a speculative execution ofinstructions by the processor; wherein the connection to thespeculation-status signal line is configured to receive the status of aspeculative execution, and wherein the status of a speculative executionindicates that a result of a speculative execution is to be accepted orrejected.
 4. The cache system of claim 3, wherein when the executiontype changes from the second type to the first type, the logic circuitis configured to: toggle the configurable data bit, if the status ofspeculative execution indicates that a result of speculative executionis to be accepted; and maintain the configurable data bit withoutchanges, if the status of speculative execution indicates that a resultof speculative execution is to be rejected.
 5. The cache system of claim1, wherein when the execution type changes from the second type to thefirst type, the logic circuit is configured to toggle the configurabledata bit.
 6. The cache system of claim 1, further comprising: aconnection to a second command bus coupled between the cache system andthe memory system; a connection to a second address bus coupled betweenthe cache system and the memory system; a connection to a second databus coupled between the cache system and the memory system; wherein whenthe configurable data bit is in a first state, the logic circuit isconfigured to: provide commands to the second command bus for accessingthe memory system via the first cache, when the execution type is afirst type; and provide commands to the second command bus for accessingthe memory system via the second cache, when the execution type is asecond type; and wherein when the configurable data bit is in a secondstate, the logic circuit is configured to: provide commands to thesecond command bus for accessing the memory system via the second cache,when the execution type is the first type; and provide commands to thesecond command bus for accessing the memory system via the first cache,when the execution type is the second type.
 7. The cache system of claim1, wherein the connection to the command bus is configured to receive aread command or a write command from the processor for accessing thememory system; wherein the connection to the address bus is configuredto receive a memory address from the processor for accessing the memorysystem for the read command or the write command; wherein the connectionto the data bus is configured to: communicate data to the processor forthe processor to read the data for the read command; receive data fromthe processor to be written in the memory system for the write command;and wherein memory access requests from the processor and memory use bythe processor are controlled through the command bus, the address bus,and the data bus.
 8. The cache system of claim 1, wherein the connectionto the execution-type signal line is configured to receive anidentification of the execution type from the processor.
 9. The cachesystem of claim 1, wherein the logic circuit is configured to: selectthe first cache for a memory access request from the processor, when theconfigurable data bit is in the first state and the connection to theexecution-type signal line receives an indication of the first type;select the second cache for a memory access request from the processor,when the configurable data bit is in the first state and the connectionto the execution-type signal line receives an indication of the secondtype; select the second cache for a memory access request from theprocessor, when the configurable data bit is in the second state and theconnection to the execution-type signal line receives an indication ofthe first type; and select the first cache for a memory access requestfrom the processor, when the configurable data bit is in the secondstate and the connection to the execution-type signal line receives anindication of the second type.
 10. A cache system, comprising: a firstcache; a second cache; a connection to a command bus, configured toreceive a read command or a write command from a processor connected tothe cache system, for reading from or writing to a memory system; aconnection to an address bus, configured to receive a memory addressfrom the processor for accessing the memory system for the read commandor the write command; a connection to a data bus, configured to:communicate data to the processor for the processor to read the data forthe read command; and receive data from the processor to be written inthe memory system for the write command; an execution-type signal line,configured to receive an identification of execution type from theprocessor, wherein the execution type is either a first execution typeor a second execution type; a configurable data bit; and a logiccircuit, configured to: select the first cache for use by the processor,when the configurable data bit is in a first state and theexecution-type signal line receives an indication of the first type ofexecution; select the second cache for use by the processor, when theconfigurable data bit is in the first state and the execution-typesignal line receives an indication of the second type of execution;select the second cache for use by the processor, when the configurabledata bit is in the second state and the execution-type signal linereceives an indication of the first type of execution; and select thefirst cache for use by the processor, when the configurable data bit isin the second state and the execution-type signal line receives anindication of the second type of execution.
 11. The cache system ofclaim 10, wherein the first type of execution is a speculative executionof instructions by the processor, and wherein the second type ofexecution is a non-speculative execution of instructions by theprocessor.
 12. The cache system of claim 11, further comprising aconnection to a speculation-status signal line, configured to receivespeculation status from the processor, wherein the speculation status iseither an acceptance or a rejection of a condition with nestedinstructions that are executed initially by a speculative execution ofthe processor and subsequently by a normal execution of the processorwhen the speculation status is the acceptance of the condition.
 13. Thecache system of claim 12, wherein the logic circuit is configured toswitch the configurable data bit from the first state to the secondstate, when the speculation status received by the speculation-statussignal line is the acceptance of the condition.
 14. The cache system ofclaim 12, wherein the logic circuit is configured to maintain the stateof the configurable data bit, when the speculation status received bythe speculation-status signal line is the rejection of the condition.15. The cache system of claim of claim 10, further comprising: aconnection to a second command bus, configured to communicate a readcommand or a write command to the memory system, wherein the readcommand or the write command is received from the processor by the cachesystem; a connection to a second address bus, configured to communicatea memory address to the memory system, wherein the memory address isreceived from the processor by the cache system; and a connection to asecond data bus, configured to: communicate data to the memory system tobe written in the memory system; and receive data from the memory systemto be communicated to the processor to be read by the processor.
 16. Thecache system of claim of claim 15, wherein when the configurable databit is in a first state, the logic circuit is configured to: providecommands to the second command bus for accessing the memory system viathe first cache, when the execution type is a first type; and providecommands to the second command bus for accessing the memory system viathe second cache, when the execution type is a second type; and whereinwhen the configurable data bit is in a second state, the logic circuitis configured to: provide commands to the second command bus foraccessing the memory system via the second cache, when the executiontype is the first type; and provide commands to the second command busfor accessing the memory system via the first cache, when the executiontype is the second type.
 17. A system, comprising: a processor; a memorysystem; and a cache system coupled between the processor and the memorysystem, comprising: a first cache; a second cache; a connection to acommand bus coupled between the cache system and the processor; aconnection to an address bus coupled between the cache system and theprocessor; a connection to a data bus coupled between the cache systemand the processor; a connection to an execution-type signal line fromthe processor identifying an execution type; a configurable data bit; alogic circuit coupled to the processor to control the first cache andthe second cache based on the configurable data bit; wherein when theconfigurable data bit is in a first state, the logic circuit isconfigured to: implement commands received from the command bus foraccessing the memory system via the first cache, when the execution typeis a first type; and implement commands received from the command busfor accessing the memory system via the second cache, when the executiontype is a second type; and wherein when the configurable data bit is ina second state, the logic circuit is configured to: implement commandsreceived from the command bus for accessing the memory system via thesecond cache, when the execution type is the first type; and implementcommands received from the command bus for accessing the memory systemvia the first cache, when the execution type is the second type.
 18. Thesystem of claim 17, wherein the first type is configured to indicatespeculative execution of instructions by the processor; and the secondtype is configured to indicate non-speculative execution of instructionsby the processor.
 19. The system of claim 18, further comprising: aconnection to a speculation-status signal line from the processoridentifying a status of a speculative execution of instructions by theprocessor; wherein the connection to the speculation-status signal lineis configured to receive the status of a speculative execution, andwherein the status of a speculative execution indicates that a result ofa speculative execution is to be accepted or rejected.
 20. The system ofclaim 19, wherein when the execution type changes from the first type tothe second type, the logic circuit is configured to: toggle theconfigurable data bit, if the status of speculative execution indicatesthat a result of speculative execution is to be accepted; and maintainthe configurable data bit without changes, if the status of speculativeexecution indicates that a result of speculative execution is to berejected.